Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TT-756] Stop Remote Runner from Silently Failing Tests #823

Merged
merged 6 commits into from
Jan 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ k8s_test_e2e_ci:
go test ./k8s/e2e/local-runner -count 1 -v -test.parallel=14 -test.timeout=1h -json 2>&1 | tee /tmp/gotest.log | gotestfmt

k8s_test_e2e_ci_remote_runner:
go test ./k8s/e2e/remote-runner -count 1 -v -test.parallel=16 -test.timeout=1h -json 2>&1 | tee /tmp/remoterunnergotest.log | gotestfmt
go test ./k8s/e2e/remote-runner -count 1 -v -test.parallel=20 -test.timeout=1h -json 2>&1 | tee /tmp/remoterunnergotest.log | gotestfmt

.PHONY: examples
examples:
Expand Down
21 changes: 21 additions & 0 deletions k8s/e2e/remote-runner/remote_runner_envs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,27 @@ func TestFundReturnShutdownLogic(t *testing.T) {
fmt.Println(environment.FAILED_FUND_RETURN)
}

func TestFailedTestLogic(t *testing.T) {
t.Skip("This test is meant to fail, and can only be evaluated by looking at the logs. Only turn on if checking this specific logic.")
t.Parallel()
testEnvConfig := common.GetTestEnvConfig(t)
e := presets.OnlyRemoteRunner(testEnvConfig)
err := e.Run()
if e.WillUseRemoteRunner() {
fmt.Println("Inside K8s?", e.Cfg.InsideK8s)
fmt.Println("Test Failed?", e.Cfg.Test.Failed())
require.True(t, e.Cfg.Test.Failed(), "Test should have failed")
fmt.Println("This is a test-of-a-test and is confusing. The test that this tests should fail. But that also means this tests fails. If you're reading this, the test has actually passed.")
return
}
t.Cleanup(func() {
assert.NoError(t, e.Shutdown())
})
require.NoError(t, err)
fmt.Println("Inside K8s?", e.Cfg.InsideK8s)
fmt.Println(environment.TEST_FAILED)
}

func TestRemoteRunnerOneSetupWithMultipeTests(t *testing.T) {
t.Parallel()
testEnvConfig := common.GetTestEnvConfig(t)
Expand Down
7 changes: 5 additions & 2 deletions k8s/environment/environment.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import (
const (
COVERAGE_DIR string = "cover"
FAILED_FUND_RETURN string = "FAILED_FUND_RETURN"
TEST_FAILED string = "TEST_FAILED"
)

const (
Expand Down Expand Up @@ -1021,10 +1022,12 @@ func DefaultJobLogFunction(e *Environment, message string) {
for _, chunk := range logChunks {
e.Cfg.Test.Log(chunk)
}
found := strings.Contains(message, FAILED_FUND_RETURN)
if found {
if strings.Contains(message, FAILED_FUND_RETURN) {
e.Cfg.fundReturnFailed = true
}
if strings.Contains(message, TEST_FAILED) {
e.Cfg.Test.Fail()
}
}

// markNotSafeToEvict adds the safe to evict annotation to the provided map if needed
Expand Down
4 changes: 4 additions & 0 deletions k8s/presets/presets.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ Enabled = true
[P2P.V2]
ListenAddresses = ["0.0.0.0:6690"]`

func OnlyRemoteRunner(config *environment.Config) *environment.Environment {
return environment.New(config)
}

// EVMOneNode local development Chainlink deployment
func EVMOneNode(config *environment.Config) (*environment.Environment, error) {

Expand Down
Loading