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

test framework: Mock DispatchHttpCall to return error #260

Open
rodrigovc opened this issue Mar 2, 2022 · 0 comments
Open

test framework: Mock DispatchHttpCall to return error #260

rodrigovc opened this issue Mar 2, 2022 · 0 comments
Labels
good first issue Good for newcomers

Comments

@rodrigovc
Copy link

I am doing unit tests for my filter with DispatchHttp, something like this:


_, err = proxywasm.DispatchHttpCall(ctx.clusterName, headers, body, nil, ctx.timeout, ctx.callback)
	if err != nil {
		proxywasm.LogCriticalf("big error: %v", err)
		proxywasm.ResumeHttpRequest()
		return types.ActionContinue
	}

I don't know of a way to mock the DispatchHttpCall method in order to return an error so we can cover this part of the code.

Is there any way of doing this?

@mathetake mathetake added the good first issue Good for newcomers label Apr 23, 2022
@mathetake mathetake changed the title Unit test - Mock DispatchHttpCall to return error test framework: Mock DispatchHttpCall to return error Apr 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants