From 2f352bdaf656ef2672f7cefd27d25f2c41a15a87 Mon Sep 17 00:00:00 2001 From: James Pickett Date: Tue, 7 Jan 2025 09:10:05 -0800 Subject: [PATCH] bump timouts to 10 seconds --- cross_language_tests/boxer_cross_test.go | 10 ++++++---- cross_language_tests/png_cross_test.go | 3 +-- cross_language_tests/rsa_cross_test.go | 9 ++++----- go.mod | 2 +- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/cross_language_tests/boxer_cross_test.go b/cross_language_tests/boxer_cross_test.go index b08fcf5..eb35344 100644 --- a/cross_language_tests/boxer_cross_test.go +++ b/cross_language_tests/boxer_cross_test.go @@ -18,6 +18,8 @@ import ( "github.com/vmihailenco/msgpack/v5" ) +const rubyCmdTimeout = 10 * time.Second + type boxerCrossTestCase struct { Key []byte Counterparty []byte @@ -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) @@ -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 @@ -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) @@ -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 diff --git a/cross_language_tests/png_cross_test.go b/cross_language_tests/png_cross_test.go index 9f3d361..0ad2c9a 100644 --- a/cross_language_tests/png_cross_test.go +++ b/cross_language_tests/png_cross_test.go @@ -8,7 +8,6 @@ import ( "path" "runtime" "testing" - "time" "github.com/kolide/kit/ulid" "github.com/kolide/krypto" @@ -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") diff --git a/cross_language_tests/rsa_cross_test.go b/cross_language_tests/rsa_cross_test.go index 7bd8591..bdbf859 100644 --- a/cross_language_tests/rsa_cross_test.go +++ b/cross_language_tests/rsa_cross_test.go @@ -8,7 +8,6 @@ import ( "os/exec" "path" "testing" - "time" "github.com/kolide/krypto" "github.com/stretchr/testify/require" @@ -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() @@ -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() @@ -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() @@ -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() diff --git a/go.mod b/go.mod index 857e0a8..dd7c2d6 100644 --- a/go.mod +++ b/go.mod @@ -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