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

Commit d52ef48

Browse files
authored
test on Istio 1.8.1 and remove proxy_get_current_time_nanoseconds (#101)
1 parent ab1ebb8 commit d52ef48

File tree

7 files changed

+9
-33
lines changed

7 files changed

+9
-33
lines changed

.github/workflows/workflow.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ jobs:
5151
e2e-tests-envoy:
5252
strategy:
5353
matrix:
54-
envoy-image: [ "envoyproxy/envoy-dev:6ca4644073da6d9930ba45d90d57d8c9b2062962" ] # TODO: add release tagged version
54+
envoy-image: [ "envoyproxy/envoy-dev:5932dfd1f6b80eda9f56415ceff056a15a699c5e" ] # TODO: add release tagged version
5555
name: e2e tests on examples
5656
needs: build-examples
5757
runs-on: ubuntu-latest
@@ -78,7 +78,7 @@ jobs:
7878
e2e-tests-istio:
7979
strategy:
8080
matrix:
81-
istio-version: [ 1.7.0, 1.7.1, 1.7.2, 1.7.3, 1.8.0 ]
81+
istio-version: [ 1.8.1 ]
8282
name: e2e tests on examples
8383
needs: build-examples
8484
runs-on: ubuntu-latest

README.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ Please follow the official instruction [here](https://tinygo.org/getting-started
4444

4545
| proxy-wasm-go-sdk| proxy-wasm ABI version |istio/proxyv2| Envoy upstream|
4646
|:-------------:|:-------------:|:-------------:|:-------------:|
47-
| main | 0.2.0| v1.17.x, v1.18.0 | [6ca4644073da6d9930ba](https://github.com/envoyproxy/envoy/tree/6ca4644073da6d9930ba45d90d57d8c9b2062962) |
48-
| v0.0.12 | 0.2.0| v1.17.x, v1.18.0 |[6ca4644073da6d9930ba](https://github.com/envoyproxy/envoy/tree/6ca4644073da6d9930ba45d90d57d8c9b2062962)
47+
| main | 0.2.0| v1.8.1 | [5932dfd1f6b80eda9f56](https://github.com/envoyproxy/envoy/tree/5932dfd1f6b80eda9f56415ceff056a15a699c5e) |
48+
| v0.0.12 | 0.2.0| v1.7.x, v1.8.0 |[6ca4644073da6d9930ba](https://github.com/envoyproxy/envoy/tree/6ca4644073da6d9930ba45d90d57d8c9b2062962)
4949

5050

5151
## run examples
@@ -86,7 +86,6 @@ make test.e2e.single name=helloworld # run e2e tests
8686
2. TinyGo does not implement all of reflect package([examples](https://github.com/tinygo-org/tinygo/blob/v0.14.1/src/reflect/value.go#L299-L305)).
8787
3. [proxy-wasm-cpp-host](https://github.com/proxy-wasm/proxy-wasm-cpp-host) has not supported some of WASI APIs yet
8888
(see the [supported functions](https://github.com/proxy-wasm/proxy-wasm-cpp-host/blob/master/include/proxy-wasm/exports.h#L134-L147)).
89-
For example, `clock_time_get` is not implemented, and therefore we cannot use `time.Now` function.
9089
- These issues will be mitigated as TinyGo and proxy-wasm-cpp-host evolve.
9190
- There's performance overhead of using Go/TinyGo due to GC
9291
- `runtime.GC` is called whenever the heap runs out (see [1](https://tinygo.org/lang-support/#garbage-collection),

examples/helloworld/main.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ package main
1616

1717
import (
1818
"math/rand"
19+
"time"
1920

2021
"github.com/tetratelabs/proxy-wasm-go-sdk/proxywasm"
2122
)
@@ -38,7 +39,7 @@ func newHelloWorld(contextID uint32) proxywasm.RootContext {
3839

3940
// override
4041
func (ctx *helloWorld) OnVMStart(vmConfigurationSize int) bool {
41-
rand.Seed(proxywasm.GetCurrentTime())
42+
rand.Seed(time.Now().UnixNano())
4243

4344
proxywasm.LogInfo("proxy_on_vm_start from Go!")
4445
if err := proxywasm.SetTickPeriodMilliSeconds(tickMilliseconds); err != nil {
@@ -50,6 +51,6 @@ func (ctx *helloWorld) OnVMStart(vmConfigurationSize int) bool {
5051

5152
// override
5253
func (ctx *helloWorld) OnTick() {
53-
t := proxywasm.GetCurrentTime()
54+
t := time.Now().UnixNano()
5455
proxywasm.LogInfof("It's %d: random value: %d", t, rand.Uint64())
5556
}

proxytest/proxytest.go

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ package proxytest
33
import (
44
"log"
55
"sync"
6-
"time"
76

87
"github.com/tetratelabs/proxy-wasm-go-sdk/proxywasm"
98
"github.com/tetratelabs/proxy-wasm-go-sdk/proxywasm/rawhostcall"
@@ -163,12 +162,6 @@ func (h *hostEmulator) ProxyGetHeaderMapPairs(mapType types.MapType, returnValue
163162
}
164163
}
165164

166-
// impl rawhostcall.ProxyWASMHost
167-
func (h *hostEmulator) ProxyGetCurrentTimeNanoseconds(returnTime *int64) types.Status {
168-
*returnTime = time.Now().UnixNano()
169-
return types.StatusOK
170-
}
171-
172165
// impl rawhostcall.ProxyWASMHost
173166
func (h *hostEmulator) ProxySetEffectiveContext(contextID uint32) types.Status {
174167
h.effectiveContextID = contextID

proxywasm/hostcall.go

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,12 +44,6 @@ func SetTickPeriodMilliSeconds(millSec uint32) error {
4444
return types.StatusToError(rawhostcall.ProxySetTickPeriodMilliseconds(millSec))
4545
}
4646

47-
func GetCurrentTime() int64 {
48-
var t int64
49-
rawhostcall.ProxyGetCurrentTimeNanoseconds(&t)
50-
return t
51-
}
52-
5347
func DispatchHttpCall(upstream string,
5448
headers [][2]string, body string, trailers [][2]string,
5549
timeoutMillisecond uint32, callBack HttpCalloutCallBack) (calloutID uint32, err error) {

proxywasm/rawhostcall/rawhostcall.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,9 +83,6 @@ func ProxyHttpCall(upstreamData *byte, upstreamSize int, headerData *byte, heade
8383
//export proxy_set_tick_period_milliseconds
8484
func ProxySetTickPeriodMilliseconds(period uint32) types.Status
8585

86-
//export proxy_get_current_time_nanoseconds
87-
func ProxyGetCurrentTimeNanoseconds(returnTime *int64) types.Status
88-
8986
//export proxy_set_effective_context
9087
func ProxySetEffectiveContext(contextID uint32) types.Status
9188

proxywasm/rawhostcall/rawhostcall_mock.go

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ type ProxyWASMHost interface {
4747
ProxySetBufferBytes(bt types.BufferType, start int, maxSize int, bufferData *byte, bufferSize int) types.Status
4848
ProxyHttpCall(upstreamData *byte, upstreamSize int, headerData *byte, headerSize int, bodyData *byte, bodySize int, trailersData *byte, trailersSize int, timeout uint32, calloutIDPtr *uint32) types.Status
4949
ProxySetTickPeriodMilliseconds(period uint32) types.Status
50-
ProxyGetCurrentTimeNanoseconds(returnTime *int64) types.Status
5150
ProxySetEffectiveContext(contextID uint32) types.Status
5251
ProxyDone() types.Status
5352
ProxyDefineMetric(metricType types.MetricType, metricNameData *byte, metricNameSize int, returnMetricIDPtr *uint32) types.Status
@@ -120,11 +119,8 @@ func (d DefaultProxyWAMSHost) ProxyHttpCall(upstreamData *byte, upstreamSize int
120119
return 0
121120
}
122121
func (d DefaultProxyWAMSHost) ProxySetTickPeriodMilliseconds(period uint32) types.Status { return 0 }
123-
func (d DefaultProxyWAMSHost) ProxyGetCurrentTimeNanoseconds(returnTime *int64) types.Status {
124-
return 0
125-
}
126-
func (d DefaultProxyWAMSHost) ProxySetEffectiveContext(contextID uint32) types.Status { return 0 }
127-
func (d DefaultProxyWAMSHost) ProxyDone() types.Status { return 0 }
122+
func (d DefaultProxyWAMSHost) ProxySetEffectiveContext(contextID uint32) types.Status { return 0 }
123+
func (d DefaultProxyWAMSHost) ProxyDone() types.Status { return 0 }
128124
func (d DefaultProxyWAMSHost) ProxyDefineMetric(metricType types.MetricType, metricNameData *byte, metricNameSize int, returnMetricIDPtr *uint32) types.Status {
129125
return 0
130126
}
@@ -227,10 +223,6 @@ func ProxySetTickPeriodMilliseconds(period uint32) types.Status {
227223
return currentHost.ProxySetTickPeriodMilliseconds(period)
228224
}
229225

230-
func ProxyGetCurrentTimeNanoseconds(returnTime *int64) types.Status {
231-
return currentHost.ProxyGetCurrentTimeNanoseconds(returnTime)
232-
}
233-
234226
func ProxySetEffectiveContext(contextID uint32) types.Status {
235227
return currentHost.ProxySetEffectiveContext(contextID)
236228
}

0 commit comments

Comments
 (0)