Skip to content
This repository was archived by the owner on Apr 24, 2025. It is now read-only.

Commit d91a09b

Browse files
authored
Merge pull request #69 from tetratelabs/fix-sdk-test-flow
fix: SDK test CI
2 parents d359ac1 + cf968df commit d91a09b

File tree

5 files changed

+12
-12
lines changed

5 files changed

+12
-12
lines changed

.github/workflows/workflow.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
go-version: 1.15
2121

2222
- name: run tests
23-
run: make test.sdk
23+
run: make test
2424

2525
build-examples:
2626
name: build examples

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ lint:
1616
golangci-lint run --build-tags proxytest
1717

1818
test:
19-
go test -tags=proxytest $(go list ./... | grep -v e2e | sed 's/github.com\/tetratelabs\/proxy-wasm-go-sdk/./g')
19+
go test -tags=proxytest $(shell go list ./... | grep -v e2e | sed 's/github.com\/tetratelabs\/proxy-wasm-go-sdk/./g')
2020

2121
test.e2e:
2222
docker run -it -w /tmp/proxy-wasm-go -v $(shell pwd):/tmp/proxy-wasm-go getenvoy/proxy-wasm-go-sdk-ci:istio-${ISTIO_VERSION} go test -v ./e2e

examples/http_auth_random/main.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,25 +27,25 @@ func main() {
2727
proxywasm.SetNewHttpContext(newContext)
2828
}
2929

30-
type httpHeaders struct {
30+
type httpAuthRandom struct {
3131
// you must embed the default context so that you need not to reimplement all the methods by yourself
3232
proxywasm.DefaultContext
3333
contextID uint32
3434
}
3535

3636
func newContext(contextID uint32) proxywasm.HttpContext {
37-
return &httpHeaders{contextID: contextID}
37+
return &httpAuthRandom{contextID: contextID}
3838
}
3939

4040
// override default
41-
func (ctx *httpHeaders) OnHttpRequestHeaders(int, bool) types.Action {
41+
func (ctx *httpAuthRandom) OnHttpRequestHeaders(int, bool) types.Action {
4242
hs, err := proxywasm.HostCallGetHttpRequestHeaders()
4343
if err != nil {
4444
proxywasm.LogCriticalf("failed to get request headers: %v", err)
4545
return types.ActionContinue
4646
}
4747
for _, h := range hs {
48-
proxywasm.LogInfof("request header from: %s: %s", h[0], h[1])
48+
proxywasm.LogInfof("request header: %s: %s", h[0], h[1])
4949
}
5050

5151
if _, err := proxywasm.HostCallDispatchHttpCall(
@@ -59,7 +59,7 @@ func (ctx *httpHeaders) OnHttpRequestHeaders(int, bool) types.Action {
5959
}
6060

6161
// override default
62-
func (ctx *httpHeaders) OnHttpCallResponse(_ int, bodySize int, _ int) {
62+
func (ctx *httpAuthRandom) OnHttpCallResponse(_ int, bodySize int, _ int) {
6363
hs, err := proxywasm.HostCallGetHttpCallResponseHeaders()
6464
if err != nil {
6565

@@ -99,6 +99,6 @@ func (ctx *httpHeaders) OnHttpCallResponse(_ int, bodySize int, _ int) {
9999
}
100100

101101
// override default
102-
func (ctx *httpHeaders) OnLog() {
102+
func (ctx *httpAuthRandom) OnLog() {
103103
proxywasm.LogInfof("%d finished", ctx.contextID)
104104
}

examples/http_auth_random/main_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import (
1010
"github.com/tetratelabs/proxy-wasm-go-sdk/proxywasm/types"
1111
)
1212

13-
func TestHttpHeaders_OnHttpRequestHeaders(t *testing.T) {
13+
func TestHttpAuthRandom_OnHttpRequestHeaders(t *testing.T) {
1414
host, done := proxytest.NewHttpFilterHost(newContext)
1515
defer done()
1616

@@ -27,7 +27,7 @@ func TestHttpHeaders_OnHttpRequestHeaders(t *testing.T) {
2727
assert.Equal(t, "request header: key: value", logs[len(logs)-2])
2828
}
2929

30-
func TestHttpHeaders_OnHttpCallResponse(t *testing.T) {
30+
func TestHttpAuthRandom_OnHttpCallResponse(t *testing.T) {
3131
host, done := proxytest.NewHttpFilterHost(newContext)
3232
defer done()
3333

examples/network/main_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ func TestNetwork_OnDownstreamData(t *testing.T) {
6262
host.PutDownstreamData(contextID, data) // OnDownstreamData is called
6363

6464
logs := host.GetLogs(types.LogLevelInfo) // retrieve logs emitted to Envoy
65-
assert.Equal(t, "downstream data received: "+msg, logs[len(logs)-1])
65+
assert.Equal(t, ">>>>>> downstream data received >>>>>>\n"+msg, logs[len(logs)-1])
6666
}
6767

6868
func TestNetwork_OnUpstreamData(t *testing.T) {
@@ -76,7 +76,7 @@ func TestNetwork_OnUpstreamData(t *testing.T) {
7676
host.PutUpstreamData(contextID, data) // OnUpstreamData is called
7777

7878
logs := host.GetLogs(types.LogLevelInfo) // retrieve logs emitted to Envoy
79-
assert.Equal(t, "upstream data received: "+msg, logs[len(logs)-1])
79+
assert.Equal(t, "<<<<<< upstream data received <<<<<<\n"+msg, logs[len(logs)-1])
8080
}
8181

8282
func TestNetwork_counter(t *testing.T) {

0 commit comments

Comments
 (0)