Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
267 changes: 0 additions & 267 deletions internal/js/modules/k6/webcrypto/tests/crypto_test.go

This file was deleted.

14 changes: 14 additions & 0 deletions internal/js/modules/k6/webcrypto/tests/subtle_crypto_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,20 @@ func TestWebPlatformTestSuite(t *testing.T) {
// if empty, no function will be called
callFn string
}{
// Crypto interface tests (not subtle.crypto)
{
catalog: "",
files: []string{
"getRandomValues.any.js",
},
},
{
catalog: "",
files: []string{
"randomUUID.https.any.js",
},
},
// SubtleCrypto interface tests
{
catalog: "digest",
files: []string{
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
diff --git a/WebCryptoAPI/getRandomValues.any.js b/WebCryptoAPI/getRandomValues.any.js
index 574134eb7..eee19abcc 100644
--- a/WebCryptoAPI/getRandomValues.any.js
+++ b/WebCryptoAPI/getRandomValues.any.js
@@ -1,13 +1,16 @@
// Step 1.
test(function() {
- assert_throws_dom("TypeMismatchError", function() {
- self.crypto.getRandomValues(new Float16Array(6))
- }, "Float16Array")
+ // Skip Float16Array tests if not supported in the runtime
+ if (typeof Float16Array !== 'undefined') {
+ assert_throws_dom("TypeMismatchError", function() {
+ self.crypto.getRandomValues(new Float16Array(6))
+ }, "Float16Array")

- assert_throws_dom("TypeMismatchError", function() {
- const len = 65536 / Float16Array.BYTES_PER_ELEMENT + 1;
- self.crypto.getRandomValues(new Float16Array(len));
- }, "Float16Array (too long)")
+ assert_throws_dom("TypeMismatchError", function() {
+ const len = 65536 / Float16Array.BYTES_PER_ELEMENT + 1;
+ self.crypto.getRandomValues(new Float16Array(len));
+ }, "Float16Array (too long)")
+ }
}, "Float16 arrays");

test(function() {
3 changes: 2 additions & 1 deletion lib/executor/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,8 @@ func getDurationContexts(parentCtx context.Context, regularDuration, gracefulSto
if gracefulStop == 0 {
return startTime, maxDurationCtx, maxDurationCtx, maxDurationCancel
}
regDurationCtx, _ = context.WithDeadline(maxDurationCtx, startTime.Add(regularDuration)) //nolint:govet
regDurationCtx, regDurationCancel := context.WithDeadline(maxDurationCtx, startTime.Add(regularDuration))
defer regDurationCancel() // Ensure the cancel function is called to avoid context leak
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not sure we want this. I would prefer a new PR which is separate from this PR if this is valid change. This PR should focus on the Web Platform Tests (WPT) approach of testing.

return startTime, maxDurationCtx, regDurationCtx, maxDurationCancel
}

Expand Down
8 changes: 4 additions & 4 deletions output/cloud/expv2/output_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ func TestOutputFlushWorkersStop(t *testing.T) {
logger: testutils.NewLogger(t),
stop: make(chan struct{}),
}
o.config.MetricPushInterval = types.NullDurationFrom(1 * time.Millisecond)
o.config.MetricPushInterval = types.NullDurationFrom(10 * time.Millisecond)
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you revert the changes in this file too? I think they deserve a new PR if these a re valid changes, with more context.


once := sync.Once{}
flusherMock := func() {
Expand All @@ -360,7 +360,7 @@ func TestOutputFlushWorkersStop(t *testing.T) {
o.wg.Wait()
}()
select {
case <-time.After(time.Second):
case <-time.After(5 * time.Second):
t.Error("timed out")
case <-done:
}
Expand All @@ -373,7 +373,7 @@ func TestOutputFlushWorkersAbort(t *testing.T) {
logger: testutils.NewLogger(t),
abort: make(chan struct{}),
}
o.config.MetricPushInterval = types.NullDurationFrom(1 * time.Millisecond)
o.config.MetricPushInterval = types.NullDurationFrom(10 * time.Millisecond)

once := sync.Once{}
flusherMock := func() {
Expand All @@ -391,7 +391,7 @@ func TestOutputFlushWorkersAbort(t *testing.T) {
o.wg.Wait()
}()
select {
case <-time.After(time.Second):
case <-time.After(5 * time.Second):
t.Error("timed out")
case <-done:
}
Expand Down
Loading
Loading