Skip to content

Commit

Permalink
Little clean with left debugging lines
Browse files Browse the repository at this point in the history
  • Loading branch information
Rd4dev committed Aug 7, 2024
1 parent 4e4c687 commit 87b45a9
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 30 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,8 @@ class ComputeAffectedTests(
} else computeAffectedTargetsForNonDevelopBranch(gitClient, bazelClient, rootDirectory)

val filteredTestTargets = filterTargets(affectedTestTargets)
println()
println("Affected test targets:")
println(filteredTestTargets.joinToString(separator = "\n") { "- $it" })

// Bucket the targets & then shuffle them so that shards are run in different orders each time
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ class CoverageRunner(
)

val fileSpecificCovDatLines = coverageData.subList(sfStartIdx, sfStartIdx + eofIdx + 1)
println("File specific Coverage data line for $bazelTestTarget: $fileSpecificCovDatLines")

val coverageDataProps = fileSpecificCovDatLines.groupBy { line ->
line.substringBefore(":")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,6 @@ class ComputeChangedFilesTest {
initializeEmptyGitRepository()
switchToFeatureBranch()
createEmptyWorkspace()
/*tempFolder.newFolder("app")
val file = tempFolder.newFile("app/First.kt")

val changedFiles = listOf(file)*/

Expand All @@ -149,7 +147,6 @@ class ComputeChangedFilesTest {
// Since the develop branch is checked out, all files should be returned.
assertThat(reportedFiles).hasSize(1)
assertThat(reportedFiles.first().changedFilesList).containsExactly("app/First.kt", "app/Second.kt", "app/Third.kt")
// assertThat(reportedFiles).exists()
}

@Test
Expand Down Expand Up @@ -195,7 +192,6 @@ class ComputeChangedFilesTest {
assertThat(reportedFiles.first().changedFilesList).containsExactly("app/First.kt")
}


@Test
fun testUtility_featureBranch_fileChange_unstaged_returnsChangedFile() {
initializeEmptyGitRepository()
Expand Down Expand Up @@ -269,8 +265,6 @@ class ComputeChangedFilesTest {
@Test
fun testUtility_developBranch_instrumentationModuleChanged_instrumentationFilesAreIgnored() {
initializeEmptyGitRepository()
// createAndCommitFile("First", "Second", subPackage = "app")
// switchToFeatureBranch()
createFiles("InstrumentationFile", subPackage = "instrumentation/src/javatests/org/oppia/android/instrumentation/player")
createFiles("Robolectric", subPackage = "instrumentation/src/javatests/org/oppia/android/instrumentation/app")
createFiles("Third", subPackage = "instrumentation")
Expand Down Expand Up @@ -312,7 +306,6 @@ class ComputeChangedFilesTest {
)
}


@Test
fun testUtility_appFile_usesAppCacheName() {
initializeEmptyGitRepository()
Expand Down Expand Up @@ -672,7 +665,7 @@ class ComputeChangedFilesTest {
pathToRoot = tempFolder.root.absolutePath,
pathToOutputFile = outputLog.absolutePath,
baseCommit = currentHeadHash,
// computeAllFilesSetting = false
computeAllFilesSetting = false
)

return parseOutputLogLines(outputLog.readLines())
Expand Down Expand Up @@ -708,10 +701,6 @@ class ComputeChangedFilesTest {
}

private fun createAndCommitFile(vararg fileNames: String, subPackage: String) {
/*tempFolder.newFolder(subPackage)
val changedFiles = fileNames.map { fileName ->
tempFolder.newFile("$subPackage/$fileName.kt")
}*/
val createdFiles = createFiles(fileNames = fileNames, subPackage = subPackage)

testGitRepository.stageFilesForCommit(createdFiles)
Expand All @@ -738,27 +727,10 @@ class ComputeChangedFilesTest {
val oldFilePath = File(tempFolder.root, "$oldSubPackage/$oldFileName.kt")
val newFilePath = File(tempFolder.root, "$newSubPackage/$newFileName.kt")

// oldFilePath.renameTo(newFilePath)

// Ensure the new directory exists
// newFilePath.parentFile?.mkdirs()

// Move the file
/*if (oldFilePath.exists()) {
oldFilePath.renameTo(newFilePath)
} else {
}*/

// oldFilePath.renameTo(newFilePath)
oldFilePath.copyTo(newFilePath)
// newFilePath.exists()
oldFilePath.delete()

testGitRepository.stageFileForCommit(newFilePath)
// testGitRepository.stageFileForCommit(File(tempFolder.root, "$newSubPackage/$newFileName.kt")) // Ensure staging of removal
// testGitRepository.stageFileForCommit(oldFilePath) // Stage the old file path for removal
// testGitRepository.stageFileForCommit(File(tempFolder.root, "$oldSubPackage/$oldFileName.kt")) // Ensure staging of removal

testGitRepository.commit(message = "Move file from $oldFilePath to $newFilePath")
}
Expand Down

0 comments on commit 87b45a9

Please sign in to comment.