Skip to content

Commit e9b255c

Browse files
committed
add log warnings to flaky tests, simplify skipping
Signed-off-by: Ashley Davis <ashley.davis@cyberark.com>
1 parent b08d214 commit e9b255c

2 files changed

Lines changed: 9 additions & 8 deletions

File tree

cmd/agent_test.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@ func TestOutputModes(t *testing.T) {
3333

3434
t.Run("machinehub", func(t *testing.T) {
3535
arktesting.SkipIfNoEnv(t)
36+
37+
t.Log("This test runs against a live service and has been known to flake. If you see timeout issues it's possible that the test is flaking and it could be unrelated to your changes.")
38+
3639
runSubprocess(t, repoRoot, []string{
3740
"--agent-config-file", filepath.Join(repoRoot, "examples/machinehub/config.yaml"),
3841
"--input-path", filepath.Join(repoRoot, "examples/machinehub/input.json"),

internal/cyberark/client_test.go

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ package cyberark_test
22

33
import (
44
"crypto/x509"
5-
"errors"
65
"testing"
76

87
"github.com/jetstack/venafi-connection-lib/http_client"
@@ -13,6 +12,7 @@ import (
1312
"github.com/jetstack/preflight/internal/cyberark"
1413
"github.com/jetstack/preflight/internal/cyberark/dataupload"
1514
"github.com/jetstack/preflight/internal/cyberark/servicediscovery"
15+
arktesting "github.com/jetstack/preflight/internal/cyberark/testing"
1616
"github.com/jetstack/preflight/pkg/testutil"
1717
"github.com/jetstack/preflight/pkg/version"
1818

@@ -63,20 +63,18 @@ func TestCyberArkClient_PutSnapshot_MockAPI(t *testing.T) {
6363
// go test ./internal/cyberark \
6464
// -v -count 1 -run TestCyberArkClient_PutSnapshot_RealAPI -args -testing.v 6
6565
func TestCyberArkClient_PutSnapshot_RealAPI(t *testing.T) {
66+
arktesting.SkipIfNoEnv(t)
67+
68+
t.Log("This test runs against a live service and has been known to flake. If you see timeout issues it's possible that the test is flaking and it could be unrelated to your changes.")
69+
6670
logger := ktesting.NewLogger(t, ktesting.DefaultConfig)
6771
ctx := klog.NewContext(t.Context(), logger)
6872

6973
var rootCAs *x509.CertPool
7074
httpClient := http_client.NewDefaultClient(version.UserAgent(), rootCAs)
7175

7276
cfg, err := cyberark.LoadClientConfigFromEnvironment()
73-
if err != nil {
74-
if errors.Is(err, cyberark.ErrMissingEnvironmentVariables) {
75-
t.Skipf("Skipping: %s", err)
76-
}
77-
78-
require.NoError(t, err)
79-
}
77+
require.NoError(t, err)
8078

8179
discoveryClient := servicediscovery.New(httpClient)
8280

0 commit comments

Comments
 (0)