-
Notifications
You must be signed in to change notification settings - Fork 36
/
Copy pathexample_test.go
42 lines (38 loc) · 1.17 KB
/
example_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
package basicauth
import (
"os"
"path/filepath"
"testing"
"time"
"istio.io/proxy/test/envoye2e/driver"
"istio.io/proxy/test/envoye2e/env"
"istio.io/proxy/testdata"
"github.com/istio-ecosystem/wasm-extensions/test"
)
func TestExamplePlugin(t *testing.T) {
params := driver.NewTestParams(t, map[string]string{
"ExampleWasmFile": filepath.Join(env.GetBazelBinOrDie(), "example.wasm"),
}, test.ExtensionE2ETests)
params.Vars["ServerHTTPFilters"] = params.LoadTestData("test/testdata/server_filter.yaml.tmpl")
if err := (&driver.Scenario{
Steps: []driver.Step{
&driver.XDS{},
&driver.Update{
Node: "server", Version: "0", Listeners: []string{string(testdata.MustAsset("listener/server.yaml.tmpl"))},
},
&driver.Envoy{
Bootstrap: params.FillTestData(string(testdata.MustAsset("bootstrap/server.yaml.tmpl"))),
DownloadVersion: os.Getenv("ISTIO_TEST_VERSION"),
},
&driver.Sleep{Duration: 1 * time.Second},
&driver.HTTPCall{
Port: params.Ports.ServerPort,
Method: "GET",
ResponseHeaders: map[string]string{"x-wasm-custom": "foo"},
ResponseCode: 200,
},
},
}).Run(params); err != nil {
t.Fatal(err)
}
}