Skip to content

Commit a2edccf

Browse files
janiszclaude
andcommitted
Use require.NotEmpty for environment variable checks
Replace manual if checks with require.NotEmpty from testify for cleaner and more idiomatic test code. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
1 parent 272bef7 commit a2edccf

1 file changed

Lines changed: 2 additions & 6 deletions

File tree

smoke/smoke_test.go

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,7 @@ func TestSmoke_RealCluster(t *testing.T) {
2222
apiToken := os.Getenv("ROX_API_TOKEN")
2323
password := os.Getenv("ROX_PASSWORD")
2424

25-
if endpoint == "" {
26-
t.Fatal("ROX_ENDPOINT environment variable must be set")
27-
}
25+
require.NotEmpty(t, endpoint, "ROX_ENDPOINT environment variable must be set")
2826

2927
// Generate token if password provided but no token
3028
if apiToken == "" && password != "" {
@@ -45,9 +43,7 @@ func TestSmoke_RealCluster(t *testing.T) {
4543
t.Log("Successfully generated API token")
4644
}
4745

48-
if apiToken == "" {
49-
t.Fatal("Either ROX_API_TOKEN or ROX_PASSWORD must be set")
50-
}
46+
require.NotEmpty(t, apiToken, "Either ROX_API_TOKEN or ROX_PASSWORD must be set")
5147

5248
// Wait for cluster to be registered and healthy
5349
assert.Eventually(t, func() bool {

0 commit comments

Comments
 (0)