Skip to content

gobco panic with Kubernetes integration tests (TestMain handling) #38

Description

@zyue110026

Hi,

I’m trying to use gobco to measure branch coverage for Kubernetes integration tests, specifically under:

kubernetes repo
Path: test/integration/apimachinery

Issue

When running gobco on these integration tests, I encounter the following panic:

panic: can only handle TestMain with explicit call to os.Exit

Context

Kubernetes integration tests frequently define a custom TestMain(m *testing.M) for environment setup/teardown (e.g., API server initialization), and not all of them explicitly call os.Exit(m.Run()).

It appears that gobco expects TestMain to strictly follow this pattern:

func TestMain(m *testing.M) {
    os.Exit(m.Run())
}

However, many real-world integration tests (including Kubernetes) use more complex logic, such as:

func TestMain(m *testing.M) {
    framework.EtcdMain(m.Run)
}

or in some cases, omit the explicit os.Exit call entirely.

Question:
Does gobco currently only support unit tests or simple TestMain patterns?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions