Skip to content

Commit

Permalink
bump timouts to 10 seconds
Browse files Browse the repository at this point in the history
  • Loading branch information
James-Pickett committed Jan 7, 2025
1 parent 46a8d5c commit 2f352bd
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
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
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

0 comments on commit 2f352bd

Please sign in to comment.