Skip test on CI.

This commit is contained in:
Mariano Cano 2020-09-16 14:03:26 -07:00
parent 91aa1e87f1
commit 884a6f5dd0

View file

@ -240,17 +240,21 @@ func TestNew_real(t *testing.T) {
} }
tests := []struct { tests := []struct {
name string name string
skipOnCI bool
args args args args
wantErr bool wantErr bool
}{ }{
{"fail default credentials", args{context.Background(), apiv1.Options{Certificateauthority: testAuthorityName}}, true}, {"fail default credentials", true, args{context.Background(), apiv1.Options{Certificateauthority: testAuthorityName}}, true},
{"fail certificate authority", args{context.Background(), apiv1.Options{}}, true}, {"fail certificate authority", false, args{context.Background(), apiv1.Options{}}, true},
{"fail with credentials", args{context.Background(), apiv1.Options{ {"fail with credentials", false, args{context.Background(), apiv1.Options{
Certificateauthority: testAuthorityName, CredentialsFile: "testdata/missing.json", Certificateauthority: testAuthorityName, CredentialsFile: "testdata/missing.json",
}}, true}, }}, true},
} }
for _, tt := range tests { for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) { t.Run(tt.name, func(t *testing.T) {
if tt.skipOnCI && os.Getenv("CI") == "true" {
t.SkipNow()
}
_, err := New(tt.args.ctx, tt.args.opts) _, err := New(tt.args.ctx, tt.args.opts)
if (err != nil) != tt.wantErr { if (err != nil) != tt.wantErr {
t.Errorf("New() error = %v, wantErr %v", err, tt.wantErr) t.Errorf("New() error = %v, wantErr %v", err, tt.wantErr)