Parcourir la source

Skip test on CI.

Mariano Cano il y a 6 ans
Parent
commit
884a6f5dd0
1 fichiers modifiés avec 10 ajouts et 6 suppressions
  1. 10 6
      cas/cloudcas/cloudcas_test.go

+ 10 - 6
cas/cloudcas/cloudcas_test.go

@@ -239,18 +239,22 @@ func TestNew_real(t *testing.T) {
 		opts apiv1.Options
 		opts apiv1.Options
 	}
 	}
 	tests := []struct {
 	tests := []struct {
-		name    string
-		args    args
-		wantErr bool
+		name     string
+		skipOnCI bool
+		args     args
+		wantErr  bool
 	}{
 	}{
-		{"fail default credentials", args{context.Background(), apiv1.Options{Certificateauthority: testAuthorityName}}, true},
-		{"fail certificate authority", args{context.Background(), apiv1.Options{}}, true},
-		{"fail with credentials", args{context.Background(), apiv1.Options{
+		{"fail default credentials", true, args{context.Background(), apiv1.Options{Certificateauthority: testAuthorityName}}, true},
+		{"fail certificate authority", false, args{context.Background(), apiv1.Options{}}, true},
+		{"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)