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

Bug in test function not interpreting test readiness correctly when 0 tasks are enabled (Does not affect production) #890

Open
wilkermichael opened this issue May 20, 2022 · 0 comments
Labels
bug Something isn't working

Comments

@wilkermichael
Copy link
Contributor

wilkermichael commented May 20, 2022

Describe the bug

The function used to detect CTS test readiness, currently doesn't work if the enabled tasks in CTS are '0' as expected. This is useful in the case where we don't care about tasks running for a particular test, and just want to test other CTS behavior.

This does not affect anything in production.

Versions

Consul Terraform Sync

consul-terraform-sync v0.6.0

Actual Behavior

If a test starts up CTS with a configuration with all tasks disabled, and the test attempts to stop CTS, the test will fail due to being unable to stop cleanly.

Steps to Reproduce

  1. Go to the following test, which doesn't require a task to run:
    func TestE2E_ServiceRegistration_DeregisterWhenStopped(t *testing.T) {
    setParallelism(t)
    srv := newTestConsulServer(t)
    defer srv.Stop()
    tempDir := fmt.Sprintf("%s%s", tempDirPrefix, "cts_stop_deregister")
    cleanup := testutils.MakeTempDir(t, tempDir)
    defer cleanup()
    id := "cts-01"
    configPath := filepath.Join(tempDir, configFile)
    config := baseConfig(tempDir).appendID(id).
    appendConsulBlock(srv).appendTerraformBlock().
    appendModuleTask("disabled_task", "mkam/hello/cts",
    "enabled = true")
    config.write(t, configPath)
  2. Change the last line from "enabled = true" to "enabled = false"
  3. This test will fail because CTS was unable to stop cleanly (because CTS was not ready for testing yet)
@wilkermichael wilkermichael added the bug Something isn't working label May 20, 2022
@wilkermichael wilkermichael changed the title Bug in Test Function not interpreting test readiness correctly when 0 tasks are enabled Bug in test function not interpreting test readiness correctly when 0 tasks are enabled May 20, 2022
@wilkermichael wilkermichael changed the title Bug in test function not interpreting test readiness correctly when 0 tasks are enabled Bug in test function not interpreting test readiness correctly when 0 tasks are enabled (Does not affect production) May 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant