Skip to content

Allow creating WASM VM context with environment variables #13

@drewcorlin1

Description

@drewcorlin1

I'm using proxytest.NewWasmVMContext() to create a WASM VM to run tests against. The system under test is deployed as an Istio WasmPlugin. My plugin sets response headers on requests that flow through my istio proxy. Some of those headers come from environment variables available to the istio-proxy (envoy instance) that I'm exposing via https://istio.io/latest/docs/reference/config/proxy_extensions/wasm-plugin/#VmConfig. This works correctly in production (and in my code I just use os.Getenv no problem), but in my test I'm unable to configure environment variables for the WASM VM in my test.

I've also tried using proxyTest.NewEmulatorOption().WithVMConfiguration() to set the VM Config but that doesn't seem to work.

I think this means allowing NewWasmVMContext to be configured with environment variables that can then be passed to wazero.NewModuleConfig() via .WithEnv() on ModuleConfig.

https://github.com/proxy-wasm/proxy-wasm-go-sdk/blob/main/proxywasm/proxytest/wasmwrapper.go#L103

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions