Skip to content
This repository has been archived by the owner on Mar 16, 2024. It is now read-only.

Add NewRequestWithContext, InvokeWithContext and InvokeFuncWithContext #107

Merged
merged 1 commit into from
Oct 23, 2023

Conversation

tylerslaton
Copy link
Contributor

Instead of breaking existing tests, this PR just adds WithContext variants of the same functions. This allows us to write unit tests like this:


func TestBasic(t *testing.T) {
	harness, input, err := tester.FromDir(managerscheme.Scheme, "testdata/basic")
	if err != nil {
		t.Fatal(err)
	}

	ctx := db.ContextWithPartitionID(context.TODO(), "account-partition-id")
	harness.InvokeFuncWithContext(t, ctx, input, Allocate)
}

pkg/router/tester/tester.go Outdated Show resolved Hide resolved
pkg/router/tester/tester.go Outdated Show resolved Hide resolved
pkg/router/tester/tester.go Outdated Show resolved Hide resolved
pkg/router/tester/tester.go Outdated Show resolved Hide resolved
pkg/router/tester/tester.go Outdated Show resolved Hide resolved
pkg/router/tester/tester.go Outdated Show resolved Hide resolved
Signed-off-by: tylerslaton <mtslaton1@gmail.com>
@tylerslaton tylerslaton merged commit 33b4d20 into acorn-io:main Oct 23, 2023
2 checks passed
@tylerslaton tylerslaton deleted the ctx-for-tests branch October 23, 2023 21:17
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants