forked from TrueCloudLab/certificates
Skip test on travis, it won't fail because they have access to the KMS.
This commit is contained in:
parent
2d4f369db2
commit
cff346e7fd
1 changed files with 12 additions and 6 deletions
|
@ -5,6 +5,7 @@ import (
|
||||||
"crypto"
|
"crypto"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
|
"os"
|
||||||
"reflect"
|
"reflect"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
|
@ -54,16 +55,21 @@ func TestNew(t *testing.T) {
|
||||||
opts apiv1.Options
|
opts apiv1.Options
|
||||||
}
|
}
|
||||||
tests := []struct {
|
tests := []struct {
|
||||||
name string
|
name string
|
||||||
args args
|
skipOnCI bool
|
||||||
want *CloudKMS
|
args args
|
||||||
wantErr bool
|
want *CloudKMS
|
||||||
|
wantErr bool
|
||||||
}{
|
}{
|
||||||
{"fail authentication", args{context.Background(), apiv1.Options{}}, nil, true},
|
{"fail authentication", true, args{context.Background(), apiv1.Options{}}, nil, true},
|
||||||
{"fail credentials", args{context.Background(), apiv1.Options{CredentialsFile: "testdata/missing"}}, nil, true},
|
{"fail credentials", false, args{context.Background(), apiv1.Options{CredentialsFile: "testdata/missing"}}, nil, 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()
|
||||||
|
}
|
||||||
|
|
||||||
got, err := New(tt.args.ctx, tt.args.opts)
|
got, 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)
|
||||||
|
|
Loading…
Add table
Reference in a new issue