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

bump cross test timeouts to 10 seconds #46

Merged
merged 2 commits into from
Jan 7, 2025
Merged
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
10 changes: 6 additions & 4 deletions cross_language_tests/boxer_cross_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ import (
"github.com/vmihailenco/msgpack/v5"
)

const rubyCmdTimeout = 10 * time.Second

type boxerCrossTestCase struct {
Key []byte
Counterparty []byte
Expand Down Expand Up @@ -95,7 +97,7 @@ func TestBoxerRuby(t *testing.T) {
//#nosec G306 -- Need readable files
require.NoError(t, os.WriteFile(rubyInFile, []byte(base64.StdEncoding.EncodeToString(b)), 0644))

ctx, cancel := context.WithTimeout(context.Background(), 2*time.Second)
ctx, cancel := context.WithTimeout(context.Background(), rubyCmdTimeout)
defer cancel()

cmd := exec.CommandContext(ctx, "ruby", boxerRB, "encode", rubyInFile, rubyOutFile)
Expand Down Expand Up @@ -204,7 +206,7 @@ func TestBoxerRuby(t *testing.T) {
//#nosec G306 -- Need readable files
require.NoError(t, os.WriteFile(testfile, []byte(base64.StdEncoding.EncodeToString(b)), 0644))

ctx, cancel := context.WithTimeout(context.Background(), 2*time.Second)
ctx, cancel := context.WithTimeout(context.Background(), rubyCmdTimeout)
defer cancel()

//#nosec G204 -- No taint on hardcoded input
Expand Down Expand Up @@ -253,7 +255,7 @@ func TestBoxerRuby(t *testing.T) {
//#nosec G306 -- Need readable files
require.NoError(t, os.WriteFile(rubyInFile, []byte(base64.StdEncoding.EncodeToString(b)), 0644))

ctx, cancel := context.WithTimeout(context.Background(), 2*time.Second)
ctx, cancel := context.WithTimeout(context.Background(), rubyCmdTimeout)
defer cancel()

cmd := exec.CommandContext(ctx, "ruby", boxerRB, "sign", rubyInFile, rubyOutFile)
Expand Down Expand Up @@ -377,7 +379,7 @@ func TestBoxerMaxSize(t *testing.T) {
//#nosec G306 -- Need readable files
require.NoError(t, os.WriteFile(testfile, []byte(base64.StdEncoding.EncodeToString(b)), 0644))

ctx, cancel := context.WithTimeout(context.Background(), 2*time.Second)
ctx, cancel := context.WithTimeout(context.Background(), rubyCmdTimeout)
defer cancel()

//#nosec G204 -- No taint on hardcoded input
Expand Down
2 changes: 1 addition & 1 deletion cross_language_tests/challenge_cross_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ func TestChallenge_RubyGenerate_GoRespondPng(t *testing.T) {

require.Equal(t, challengeData, innerResponse.ChallengeData)
require.Equal(t, responderData, innerResponse.ResponseData)
require.WithinDuration(t, time.Now(), time.Unix(innerResponse.Timestamp, 0), time.Second*5)
require.WithinDuration(t, time.Now(), time.Unix(innerResponse.Timestamp, 0), rubyCmdTimeout)
})
}
}
Expand Down
3 changes: 1 addition & 2 deletions cross_language_tests/png_cross_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import (
"path"
"runtime"
"testing"
"time"

"github.com/kolide/kit/ulid"
"github.com/kolide/krypto"
Expand Down Expand Up @@ -64,7 +63,7 @@ func TestPngRuby(t *testing.T) {
t.Skip("skip png decode test on windows because ruby library chunky_png is looking for CRLF png signature")
}

ctx, cancel := context.WithTimeout(context.Background(), 2*time.Second)
ctx, cancel := context.WithTimeout(context.Background(), rubyCmdTimeout)
defer cancel()

resultFile := path.Join(dir, ulid.New()+".dat")
Expand Down
9 changes: 4 additions & 5 deletions cross_language_tests/rsa_cross_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import (
"os/exec"
"path"
"testing"
"time"

"github.com/kolide/krypto"
"github.com/stretchr/testify/require"
Expand Down Expand Up @@ -59,7 +58,7 @@ func TestRsaRuby(t *testing.T) {
t.Parallel()
tt := tt

ctx, cancel := context.WithTimeout(context.Background(), 2*time.Second)
ctx, cancel := context.WithTimeout(context.Background(), rubyCmdTimeout)
defer cancel()

dir := t.TempDir()
Expand Down Expand Up @@ -90,7 +89,7 @@ func TestRsaRuby(t *testing.T) {
t.Parallel()
tt := tt

ctx, cancel := context.WithTimeout(context.Background(), 2*time.Second)
ctx, cancel := context.WithTimeout(context.Background(), rubyCmdTimeout)
defer cancel()

dir := t.TempDir()
Expand Down Expand Up @@ -119,7 +118,7 @@ func TestRsaRuby(t *testing.T) {
t.Parallel()
tt := tt

ctx, cancel := context.WithTimeout(context.Background(), 2*time.Second)
ctx, cancel := context.WithTimeout(context.Background(), rubyCmdTimeout)
defer cancel()

dir := t.TempDir()
Expand Down Expand Up @@ -151,7 +150,7 @@ func TestRsaRuby(t *testing.T) {
t.Parallel()
tt := tt

ctx, cancel := context.WithTimeout(context.Background(), 2*time.Second)
ctx, cancel := context.WithTimeout(context.Background(), rubyCmdTimeout)
defer cancel()

dir := t.TempDir()
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/kolide/krypto

go 1.22
go 1.22.0

require (
github.com/kolide/kit v0.0.0-20221107170827-fb85e3d59eab
Expand Down
Loading