Skip to content

libgit2: Testing managed and unmanaged transport #745

@pjbgf

Description

@pjbgf

Given that managed.InitManagedTransport is an unreversible operation, and that we want to support both unmanaged and managed transport for at least a minor release, we might want to run tests against both when that makes sense, and skip when a specific test is transport sensitive.

Something around the lines of:

func TestMain(m *testing.M) {
	// execute test against unmanaged transport
	code := m.Run()
	if code != 0 {
		os.Exit(code)
	}
	managed.InitManagedTransport(logr.Discard())

	// execute test against managed transport
	code = m.Run()
	os.Exit(code)
}

func TestManaged_something(t *testing.T) {
	if !managed.Enabled() {
		t.Skip()
	}

	// Managed only tests...
}

func TestUnmanaged_something(t *testing.T) {
	if managed.Enabled() {
		t.Skip()
	}

	// Unmanaged only tests...
}

func TestBoth_something(t *testing.T) {
	// Test supported for both managed and unmanaged...
}

Potential follow-up of #744, #727 and #718.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/gitGit related issues and pull requestsarea/testingTesting related issues and pull requests

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions