Skip to content

Commit

Permalink
Integration test for uploading source bundles in empty project (#105)
Browse files Browse the repository at this point in the history
#skip-changelog

## 📜 Description
add integration test for PR #103


## 💡 Motivation and Context
<!--- Why is this change required? What problem does it solve? -->
<!--- If it fixes an open issue, please link to the issue here. -->


## 💚 How did you test it?


## 📝 Checklist
<!--- Put an `x` in the boxes that apply -->
- [ ] I reviewed the submitted code
- [ ] I added tests to verify the changes
- [ ] I updated the docs if needed
- [ ] No breaking changes


## 🔮 Next steps
  • Loading branch information
lbloder authored Jan 27, 2025
1 parent 2a0158a commit d727747
Showing 1 changed file with 24 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,20 @@ class SentryCliWhitespacesTestIT {
verifier.resetStreams()
}

@Test
fun buildsSuccessfullyWithNoSourceRootAndLogs() {
val cliPath = SentryCliProvider.getCliPath(MavenProject(), null)
val baseDir = setupEmptyProject()

val path = getPOM(baseDir, sentryCliPath = cliPath)

val verifier = Verifier(path)
verifier.isAutoclean = false
verifier.executeGoal("install")
verifier.verifyErrorFreeLog()
verifier.verifyTextInLog("Skipping module, as it doesn't have any source roots")
}

private fun setupProject(): File {
val baseDir = File(file, "base with spaces")
val srcDir = File(baseDir, "/src/main/java")
Expand All @@ -97,6 +111,16 @@ class SentryCliWhitespacesTestIT {
return baseDir
}

private fun setupEmptyProject(): File {
val baseDir = File(file, "empty-base-dir")
val baseDirResult = baseDir.mkdir()

assertTrue(baseDirResult, "Error creating base directory")
installMavenWrapper(baseDir, "3.8.6")

return baseDir
}

private fun getUploadedBundleIdFromLog(output: String): String? {
val uploadedIdRegex = """\w+":\{"state":"ok","missingChunks":\[],"uploaded_id":"(\w+-\w+-\w+-\w+-\w+)""".toRegex()
return uploadedIdRegex.find(output)?.groupValues?.get(1)
Expand Down

0 comments on commit d727747

Please sign in to comment.