Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: setup initial structure and functionality of xk6-coap #1

Merged
merged 1 commit into from
May 30, 2023

Conversation

hasheddan
Copy link
Contributor

Sets up basic functionality for xk6-coap, allowing for simple GET and OBSERVE load tests to be executed.

@beriberikix
Copy link

This may be helpful (or distracting) but the official test suite for CoAP interop was originally developed using TTCN-3. There's a few related Eclipse projects that might have relevant tests to emulate:

coap/coap.go Outdated
return client.obj
}

// client is a CoAP client with a DTLD connection.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// client is a CoAP client with a DTLD connection.
// client is a CoAP client with a DTLS connection.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah thanks for catching!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed!

@miguel91it
Copy link

@hasheddan, i tried to run the make build locally, just to see things working, and i got this error message:

$ make build

installing xk6
go: downloading go.k6.io/xk6 v0.9.1
xk6 successfully installed
2023/05/25 09:37:43 [INFO] Temporary folder: /tmp/buildenv_2023-05-25-0937.2518995701
2023/05/25 09:37:43 [INFO] Initializing Go module
2023/05/25 09:37:43 [INFO] exec (timeout=10s): /home/miguel/.gvm/gos/go1.19/bin/go mod init k6 
go: creating new go.mod: module k6
2023/05/25 09:37:43 [INFO] Replace github.com/golioth/xk6-coap => /home/miguel/Golioth/Codes/xk6-coap
2023/05/25 09:37:43 [INFO] exec (timeout=0s): /home/miguel/.gvm/gos/go1.19/bin/go mod edit -replace github.com/golioth/xk6-coap=/home/miguel/Golioth/Codes/xk6-coap 
2023/05/25 09:37:43 [INFO] exec (timeout=0s): /home/miguel/.gvm/gos/go1.19/bin/go mod tidy -compat=1.17 
go: warning: "all" matched no packages
2023/05/25 09:37:43 [INFO] Pinning versions
2023/05/25 09:37:43 [INFO] exec (timeout=0s): /home/miguel/.gvm/gos/go1.19/bin/go mod tidy -compat=1.17 
go: found github.com/golioth/xk6-coap in github.com/golioth/xk6-coap v0.0.0-00010101000000-000000000000
go: downloading go.k6.io/k6 v0.44.1
go: downloading github.com/plgd-dev/go-coap/v3 v3.1.2
go: downloading github.com/dop251/goja v0.0.0-20230402114112-623f9dda9079
go: downloading github.com/pion/transport/v2 v2.2.0
go: downloading golang.org/x/crypto v0.8.0
go: downloading github.com/dlclark/regexp2 v1.7.0
go: downloading github.com/google/pprof v0.0.0-20230207041349-798e818bf904
go: downloading github.com/hashicorp/go-multierror v1.1.1
go: downloading github.com/go-sourcemap/sourcemap v2.1.4-0.20211119122758-180fcef48034+incompatible
go: downloading golang.org/x/exp v0.0.0-20230425010034-47ecfdc1ba53
go: downloading github.com/serenize/snaker v0.0.0-20201027110005-a7ad2135616e
go: downloading golang.org/x/time v0.3.0
go: downloading gopkg.in/guregu/null.v3 v3.3.0
go: downloading github.com/hashicorp/errwrap v1.1.0
go: downloading github.com/mstoykov/atlas v0.0.0-20220811071828-388f114305dd
go: downloading github.com/onsi/gomega v1.27.6
go: downloading github.com/mstoykov/envconfig v1.4.1-0.20220114105314-765c6d8c76f1
go: downloading github.com/google/go-cmp v0.5.8
go: downloading github.com/andybalholm/brotli v1.0.5
go: downloading github.com/gorilla/websocket v1.5.0
go: downloading github.com/mccutchen/go-httpbin v1.1.2-0.20190116014521-c5cb2f4802fa
go: downloading google.golang.org/grpc v1.53.0
go: finding module for package github.com/nxadm/tail
go: found github.com/nxadm/tail in github.com/nxadm/tail v1.4.8
go: downloading github.com/fsnotify/fsnotify v1.5.4
2023/05/25 09:37:55 [INFO] Writing main module: /tmp/buildenv_2023-05-25-0937.2518995701/main.go
2023/05/25 09:37:55 [INFO] exec (timeout=0s): /home/miguel/.gvm/gos/go1.19/bin/go mod tidy -compat=1.17 
go: downloading github.com/grafana/xk6-output-prometheus-remote v0.1.0
go: downloading golang.org/x/term v0.7.0
go: downloading github.com/spf13/cobra v1.4.0
go: downloading github.com/tidwall/pretty v1.2.1
go: downloading github.com/grafana/xk6-redis v0.1.1
go: downloading github.com/grafana/xk6-timers v0.1.2
go: downloading github.com/grafana/xk6-webcrypto v0.1.0
go: downloading github.com/grafana/xk6-websockets v0.2.0
go: downloading github.com/DataDog/datadog-go v0.0.0-20180330214955-e67964b4021a
go: downloading github.com/influxdata/influxdb1-client v0.0.0-20190402204710-8ff2fc3824fc
go: downloading github.com/Soontao/goHttpDigestClient v0.0.0-20170320082612-6d28bb1415c5
go: downloading github.com/Azure/go-ntlmssp v0.0.0-20221128193559-754e69321358
go: downloading github.com/nu7hatch/gouuid v0.0.0-20131221200532-179d4d0c4d8d
go: downloading github.com/grafana/xk6-browser v0.9.0
go: downloading github.com/jhump/protoreflect v1.15.0
go: downloading github.com/PuerkitoBio/goquery v1.8.1
go: downloading github.com/mstoykov/k6-taskqueue-lib v0.1.0
go: downloading github.com/prometheus/client_golang v1.14.1-0.20221122130035-8b6e68085b10
go: downloading go.buf.build/grpc/go/prometheus/prometheus v1.4.4
go: downloading github.com/andybalholm/cascadia v1.3.1
go: downloading github.com/bufbuild/protocompile v0.2.1-0.20230123224550-da57cd758c2f
go: downloading go.buf.build/grpc/go/gogo/protobuf v1.4.9
go: downloading github.com/prometheus/common v0.37.0
go: downloading github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369
go: downloading github.com/chromedp/cdproto v0.0.0-20221023212508-67ada9507fb2
go: downloading github.com/chromedp/sysutil v1.0.0
2023/05/25 09:38:09 [INFO] Build environment ready
2023/05/25 09:38:09 [INFO] Building k6
2023/05/25 09:38:09 [INFO] exec (timeout=0s): /home/miguel/.gvm/gos/go1.19/bin/go mod tidy -compat=1.17 
2023/05/25 09:38:09 [INFO] exec (timeout=0s): /home/miguel/.gvm/gos/go1.19/bin/go build -o /home/miguel/Golioth/Codes/xk6-coap/k6 -ldflags=-w -s -trimpath 
# github.com/plgd-dev/go-coap/v3/udp/client
github.com/plgd-dev/go-coap/v3@v3.1.2/net/client/receivedMessageReader.go:41:11: internal compiler error: method ReleaseMessage on *uint8 not found

Please file a bug report including a short program that triggers the error.
https://go.dev/issue/new
# github.com/plgd-dev/go-coap/v3/tcp/client
github.com/plgd-dev/go-coap/v3@v3.1.2/net/client/receivedMessageReader.go:41:11: internal compiler error: method ReleaseMessage on *uint8 not found

Please file a bug report including a short program that triggers the error.
https://go.dev/issue/new
2023/05/25 09:38:42 [INFO] Cleaning up temporary folder: /tmp/buildenv_2023-05-25-0937.2518995701
2023/05/25 09:38:42 [FATAL] exit status 2
make: *** [Makefile:15: build] Error 1

Do you know what it could be? As i'm focused on other things, i did not dive into the problem.

Copy link
Contributor Author

@hasheddan hasheddan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you know what it could be? As i'm focused on other things, i did not dive into the problem.

@miguel91it sounds like golang/go#55270 -- could you try updating your Go install and trying again?

coap/coap.go Outdated
return client.obj
}

// client is a CoAP client with a DTLD connection.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah thanks for catching!

Sets up basic functionality for xk6-coap, allowing for simple GET and
OBSERVE load tests to be executed.

Signed-off-by: Daniel Mangum <georgedanielmangum@gmail.com>
@miguel91it
Copy link

Upgrading go worked, Dan, thank you.

I run the k6 binary and i got this:

./k6 run ./examples/simple.js --vus 10 --duration 5s

          /\      |‾‾| /‾‾/   /‾‾/   
     /\  /  \     |  |/  /   /  /    
    /  \/    \    |     (   /   ‾‾\  
   /          \   |  |\  \ |  (‾)  | 
  / __________ \  |__| \__\ \_____/ .io

  execution: local
     script: ./examples/simple.js
     output: -

  scenarios: (100.00%) 1 scenario, 10 max VUs, 35s max duration (incl. graceful stop):
           * default: 10 looping VUs for 5s (gracefulStop: 30s)

ERRO[0001] GoError: handshake error: alert: Alert Fatal: InternalError
running at file:///home/miguel/Golioth/Codes/xk6-coap/examples/simple.js:4:15(4)  executor=constant-vus scenario=default source=stacktrace
ERRO[0001] GoError: handshake error: alert: Alert Fatal: InternalError
running at file:///home/miguel/Golioth/Codes/xk6-coap/examples/simple.js:4:15(4)  executor=constant-vus scenario=default source=stacktrace
ERRO[0001] GoError: handshake error: alert: Alert Fatal: InternalError
running at file:///home/miguel/Golioth/Codes/xk6-coap/examples/simple.js:4:15(4)  executor=constant-vus scenario=default source=stacktrace
ERRO[0001] GoError: handshake error: alert: Alert Fatal: InternalError
running at file:///home/miguel/Golioth/Codes/xk6-coap/examples/simple.js:4:15(4)  executor=constant-vus scenario=default source=stacktrace
ERRO[0001] GoError: handshake error: alert: Alert Fatal: InternalError
running at file:///home/miguel/Golioth/Codes/xk6-coap/examples/simple.js:4:15(4)  executor=constant-vus scenario=default source=stacktrace
ERRO[0001] GoError: handshake error: alert: Alert Fatal: InternalError
running at file:///home/miguel/Golioth/Codes/xk6-coap/examples/simple.js:4:15(4)  executor=constant-vus scenario=default source=stacktrace
ERRO[0001] GoError: handshake error: alert: Alert Fatal: InternalError
running at file:///home/miguel/Golioth/Codes/xk6-coap/examples/simple.js:4:15(4)  executor=constant-vus scenario=default source=stacktrace
ERRO[0002] GoError: handshake error: alert: Alert Fatal: InternalError
running at file:///home/miguel/Golioth/Codes/xk6-coap/examples/simple.js:4:15(4)  executor=constant-vus scenario=default source=stacktrace
ERRO[0002] GoError: handshake error: alert: Alert Fatal: InternalError
running at file:///home/miguel/Golioth/Codes/xk6-coap/examples/simple.js:4:15(4)  executor=constant-vus scenario=default source=stacktrace
ERRO[0002] GoError: handshake error: alert: Alert Fatal: InternalError
running at file:///home/miguel/Golioth/Codes/xk6-coap/examples/simple.js:4:15(4)  executor=constant-vus scenario=default source=stacktrace
ERRO[0002] GoError: handshake error: alert: Alert Fatal: InternalError
running at file:///home/miguel/Golioth/Codes/xk6-coap/examples/simple.js:4:15(4)  executor=constant-vus scenario=default source=stacktrace
ERRO[0002] GoError: handshake error: alert: Alert Fatal: InternalError
running at file:///home/miguel/Golioth/Codes/xk6-coap/examples/simple.js:4:15(4)  executor=constant-vus scenario=default source=stacktrace
ERRO[0002] GoError: handshake error: alert: Alert Fatal: InternalError
running at file:///home/miguel/Golioth/Codes/xk6-coap/examples/simple.js:4:15(4)  executor=constant-vus scenario=default source=stacktrace
ERRO[0002] GoError: handshake error: alert: Alert Fatal: InternalError
running at file:///home/miguel/Golioth/Codes/xk6-coap/examples/simple.js:4:15(4)  executor=constant-vus scenario=default source=stacktrace
ERRO[0002] GoError: handshake error: alert: Alert Fatal: InternalError
running at file:///home/miguel/Golioth/Codes/xk6-coap/examples/simple.js:4:15(4)  executor=constant-vus scenario=default source=stacktrace
ERRO[0003] GoError: handshake error: alert: Alert Fatal: InternalError
running at file:///home/miguel/Golioth/Codes/xk6-coap/examples/simple.js:4:15(4)  executor=constant-vus scenario=default source=stacktrace
ERRO[0003] GoError: handshake error: alert: Alert Fatal: InternalError
running at file:///home/miguel/Golioth/Codes/xk6-coap/examples/simple.js:4:15(4)  executor=constant-vus scenario=default source=stacktrace
ERRO[0003] GoError: handshake error: alert: Alert Fatal: InternalError
running at file:///home/miguel/Golioth/Codes/xk6-coap/examples/simple.js:4:15(4)  executor=constant-vus scenario=default source=stacktrace
ERRO[0003] GoError: handshake error: alert: Alert Fatal: InternalError
running at file:///home/miguel/Golioth/Codes/xk6-coap/examples/simple.js:4:15(4)  executor=constant-vus scenario=default source=stacktrace
ERRO[0003] GoError: handshake error: alert: Alert Fatal: InternalError
running at file:///home/miguel/Golioth/Codes/xk6-coap/examples/simple.js:4:15(4)  executor=constant-vus scenario=default source=stacktrace
ERRO[0003] GoError: handshake error: alert: Alert Fatal: InternalError
running at file:///home/miguel/Golioth/Codes/xk6-coap/examples/simple.js:4:15(4)  executor=constant-vus scenario=default source=stacktrace
ERRO[0003] GoError: handshake error: alert: Alert Fatal: InternalError
running at file:///home/miguel/Golioth/Codes/xk6-coap/examples/simple.js:4:15(4)  executor=constant-vus scenario=default source=stacktrace
ERRO[0003] GoError: handshake error: alert: Alert Fatal: InternalError
running at file:///home/miguel/Golioth/Codes/xk6-coap/examples/simple.js:4:15(4)  executor=constant-vus scenario=default source=stacktrace
ERRO[0003] GoError: handshake error: alert: Alert Fatal: InternalError
running at file:///home/miguel/Golioth/Codes/xk6-coap/examples/simple.js:4:15(4)  executor=constant-vus scenario=default source=stacktrace
ERRO[0004] GoError: handshake error: alert: Alert Fatal: InternalError
running at file:///home/miguel/Golioth/Codes/xk6-coap/examples/simple.js:4:15(4)  executor=constant-vus scenario=default source=stacktrace
ERRO[0004] GoError: handshake error: alert: Alert Fatal: InternalError
running at file:///home/miguel/Golioth/Codes/xk6-coap/examples/simple.js:4:15(4)  executor=constant-vus scenario=default source=stacktrace
ERRO[0004] GoError: handshake error: alert: Alert Fatal: InternalError
running at file:///home/miguel/Golioth/Codes/xk6-coap/examples/simple.js:4:15(4)  executor=constant-vus scenario=default source=stacktrace
ERRO[0004] GoError: handshake error: alert: Alert Fatal: InternalError
running at file:///home/miguel/Golioth/Codes/xk6-coap/examples/simple.js:4:15(4)  executor=constant-vus scenario=default source=stacktrace
ERRO[0004] GoError: handshake error: alert: Alert Fatal: InternalError
running at file:///home/miguel/Golioth/Codes/xk6-coap/examples/simple.js:4:15(4)  executor=constant-vus scenario=default source=stacktrace
ERRO[0004] GoError: handshake error: alert: Alert Fatal: InternalError
running at file:///home/miguel/Golioth/Codes/xk6-coap/examples/simple.js:4:15(4)  executor=constant-vus scenario=default source=stacktrace
ERRO[0004] GoError: handshake error: alert: Alert Fatal: InternalError
running at file:///home/miguel/Golioth/Codes/xk6-coap/examples/simple.js:4:15(4)  executor=constant-vus scenario=default source=stacktrace
ERRO[0004] GoError: handshake error: alert: Alert Fatal: InternalError
running at file:///home/miguel/Golioth/Codes/xk6-coap/examples/simple.js:4:15(4)  executor=constant-vus scenario=default source=stacktrace
ERRO[0005] GoError: handshake error: alert: Alert Fatal: InternalError
running at file:///home/miguel/Golioth/Codes/xk6-coap/examples/simple.js:4:15(4)  executor=constant-vus scenario=default source=stacktrace
ERRO[0005] GoError: handshake error: alert: Alert Fatal: InternalError
running at file:///home/miguel/Golioth/Codes/xk6-coap/examples/simple.js:4:15(4)  executor=constant-vus scenario=default source=stacktrace
ERRO[0005] GoError: handshake error: alert: Alert Fatal: InternalError
running at file:///home/miguel/Golioth/Codes/xk6-coap/examples/simple.js:4:15(4)  executor=constant-vus scenario=default source=stacktrace
ERRO[0005] GoError: handshake error: alert: Alert Fatal: InternalError
running at file:///home/miguel/Golioth/Codes/xk6-coap/examples/simple.js:4:15(4)  executor=constant-vus scenario=default source=stacktrace
ERRO[0005] GoError: handshake error: alert: Alert Fatal: InternalError
running at file:///home/miguel/Golioth/Codes/xk6-coap/examples/simple.js:4:15(4)  executor=constant-vus scenario=default source=stacktrace
ERRO[0005] GoError: handshake error: alert: Alert Fatal: InternalError
running at file:///home/miguel/Golioth/Codes/xk6-coap/examples/simple.js:4:15(4)  executor=constant-vus scenario=default source=stacktrace
ERRO[0005] GoError: handshake error: alert: Alert Fatal: InternalError
running at file:///home/miguel/Golioth/Codes/xk6-coap/examples/simple.js:4:15(4)  executor=constant-vus scenario=default source=stacktrace
ERRO[0005] GoError: handshake error: alert: Alert Fatal: InternalError
running at file:///home/miguel/Golioth/Codes/xk6-coap/examples/simple.js:4:15(4)  executor=constant-vus scenario=default source=stacktrace
ERRO[0006] GoError: handshake error: alert: Alert Fatal: InternalError
running at file:///home/miguel/Golioth/Codes/xk6-coap/examples/simple.js:4:15(4)  executor=constant-vus scenario=default source=stacktrace
ERRO[0006] GoError: handshake error: alert: Alert Fatal: InternalError
running at file:///home/miguel/Golioth/Codes/xk6-coap/examples/simple.js:4:15(4)  executor=constant-vus scenario=default source=stacktrace
ERRO[0006] GoError: handshake error: alert: Alert Fatal: InternalError
running at file:///home/miguel/Golioth/Codes/xk6-coap/examples/simple.js:4:15(4)  executor=constant-vus scenario=default source=stacktrace
ERRO[0006] GoError: handshake error: alert: Alert Fatal: InternalError
running at file:///home/miguel/Golioth/Codes/xk6-coap/examples/simple.js:4:15(4)  executor=constant-vus scenario=default source=stacktrace
ERRO[0006] GoError: handshake error: alert: Alert Fatal: InternalError
running at file:///home/miguel/Golioth/Codes/xk6-coap/examples/simple.js:4:15(4)  executor=constant-vus scenario=default source=stacktrace
ERRO[0006] GoError: handshake error: alert: Alert Fatal: InternalError
running at file:///home/miguel/Golioth/Codes/xk6-coap/examples/simple.js:4:15(4)  executor=constant-vus scenario=default source=stacktrace
ERRO[0006] GoError: handshake error: alert: Alert Fatal: InternalError
running at file:///home/miguel/Golioth/Codes/xk6-coap/examples/simple.js:4:15(4)  executor=constant-vus scenario=default source=stacktrace
ERRO[0006] GoError: handshake error: alert: Alert Fatal: InternalError
running at file:///home/miguel/Golioth/Codes/xk6-coap/examples/simple.js:4:15(4)  executor=constant-vus scenario=default source=stacktrace
ERRO[0007] GoError: handshake error: alert: Alert Fatal: InternalError
running at file:///home/miguel/Golioth/Codes/xk6-coap/examples/simple.js:4:15(4)  executor=constant-vus scenario=default source=stacktrace
ERRO[0007] GoError: handshake error: alert: Alert Fatal: InternalError
running at file:///home/miguel/Golioth/Codes/xk6-coap/examples/simple.js:4:15(4)  executor=constant-vus scenario=default source=stacktrace

     data_received........: 0 B 0 B/s
     data_sent............: 0 B 0 B/s
     iteration_duration...: avg=1.21s min=830.17ms med=977.11ms max=2.07s p(90)=1.95s p(95)=2.04s
     iterations...........: 50  7.330719/s
     vus..................: 2   min=2      max=10
     vus_max..............: 10  min=10     max=10


running (06.8s), 00/10 VUs, 50 complete and 0 interrupted iterations
default ✓ [======================================] 10 VUs  5s

I'm gonna approve the PR in order to unblock you to continue. Do you think i need to change the default PSK/PSK-ID values?

Copy link

@miguel91it miguel91it left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm gonna approve to unblock you if you think the errors in due to my local environment.

Copy link
Contributor Author

@hasheddan hasheddan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you think i need to change the default PSK/PSK-ID values?

Thanks @miguel91it! You should need to set COAP_PSK and COAP_PSK_ID to valid values for coap.golioth.io 👍🏻

@hasheddan hasheddan merged commit f5acf08 into main May 30, 2023
@hasheddan hasheddan deleted the feat/initial-impl branch August 1, 2023 12:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants