proxy-wasm-go-sdk icon indicating copy to clipboard operation
proxy-wasm-go-sdk copied to clipboard

WIP: Allow overriding WasmResult of mocked foreign functions

Open jamesmulcahy opened this issue 3 years ago • 1 comments

I'd like to be able to generate better coverage of my foreign functions, but right now, the code limits you to an implicit "Ok" result. This prevents me testing some of the error paths behaviors in my WASM extensions.

This PR is an attempt to make that interface more generic. The problem I see is that I need a "WasmResult" type, but the only existing thing like that is internal.Status.....which is internal.

I've added an explicit WasmResult type, but with obvious downsides (internal.Status and types.WasmResult need to be in sync, otherwise things will get nasty).

I'm not 100% sure on the best path forward, but thought I'd open this PR to drive a discussion. I welcome feedback on better/alternate approches!

jamesmulcahy avatar Jan 18 '22 06:01 jamesmulcahy

sorry @jamesmulcahy I will take a look at this within next 24 hrs..

mathetake avatar Jan 21 '22 00:01 mathetake