Skip to content

Commit

Permalink
internal/civisibility: test fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
tonyredondo committed Oct 9, 2024
1 parent 4b982bd commit fd89e47
Showing 1 changed file with 6 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,7 @@ func runFlakyTestRetriesTests(m *testing.M) {
currentM = m
mTracer = integrations.InitializeCIVisibilityMock()

// execute the tests, because we are expecting some tests to fail and check the assertion later
// we don't store the exit code from the test runner
// execute the tests, we are expecting some tests to fail and check the assertion later
exitCode := RunM(m)
if exitCode != 1 {
panic("expected the exit code to be 1. We have a failing test on purpose.")
Expand Down Expand Up @@ -164,8 +163,7 @@ func runEarlyFlakyTestDetectionTests(m *testing.M) {
currentM = m
mTracer = integrations.InitializeCIVisibilityMock()

// execute the tests, because we are expecting some tests to fail and check the assertion later
// we don't store the exit code from the test runner
// execute the tests, we are expecting some tests to fail and check the assertion later
exitCode := RunM(m)
if exitCode != 1 {
panic("expected the exit code to be 1. We have a failing test on purpose.")
Expand Down Expand Up @@ -263,8 +261,7 @@ func runFlakyTestRetriesWithEarlyFlakyTestDetectionTests(m *testing.M) {
currentM = m
mTracer = integrations.InitializeCIVisibilityMock()

// execute the tests, because we are expecting some tests to fail and check the assertion later
// we don't store the exit code from the test runner
// execute the tests, we are expecting some tests to fail and check the assertion later
exitCode := RunM(m)
if exitCode != 1 {
panic("expected the exit code to be 1. We have a failing test on purpose.")
Expand Down Expand Up @@ -425,9 +422,7 @@ func setUpHttpServer(flakyRetriesEnabled bool, earlyFlakyDetectionEnabled bool,

fmt.Printf("MockApi sending response: %v\n", response)
json.NewEncoder(w).Encode(&response)
}

if earlyFlakyDetectionEnabled && r.URL.Path == "/api/v2/ci/libraries/tests" {
} else if earlyFlakyDetectionEnabled && r.URL.Path == "/api/v2/ci/libraries/tests" {
w.Header().Set("Content-Type", "application/json")
response := struct {
Data struct {
Expand All @@ -443,6 +438,8 @@ func setUpHttpServer(flakyRetriesEnabled bool, earlyFlakyDetectionEnabled bool,

fmt.Printf("MockApi sending response: %v\n", response)
json.NewEncoder(w).Encode(&response)
} else {
http.NotFound(w, r)
}
}))

Expand Down

0 comments on commit fd89e47

Please sign in to comment.