forked from TrueCloudLab/certificates
Skip test on travis.
This commit is contained in:
parent
b11bbd5728
commit
6987a46b76
1 changed files with 16 additions and 10 deletions
|
@ -2,6 +2,7 @@ package kms
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"os"
|
||||||
"reflect"
|
"reflect"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
|
@ -18,20 +19,25 @@ func TestNew(t *testing.T) {
|
||||||
opts apiv1.Options
|
opts apiv1.Options
|
||||||
}
|
}
|
||||||
tests := []struct {
|
tests := []struct {
|
||||||
name string
|
name string
|
||||||
args args
|
skipOnCI bool
|
||||||
want KeyManager
|
args args
|
||||||
wantErr bool
|
want KeyManager
|
||||||
|
wantErr bool
|
||||||
}{
|
}{
|
||||||
{"softkms", args{ctx, apiv1.Options{Type: "softkms"}}, &softkms.SoftKMS{}, false},
|
{"softkms", false, args{ctx, apiv1.Options{Type: "softkms"}}, &softkms.SoftKMS{}, false},
|
||||||
{"default", args{ctx, apiv1.Options{}}, &softkms.SoftKMS{}, false},
|
{"default", false, args{ctx, apiv1.Options{}}, &softkms.SoftKMS{}, false},
|
||||||
{"cloudkms", args{ctx, apiv1.Options{Type: "cloudkms"}}, &cloudkms.CloudKMS{}, true}, // fails because not credentials
|
{"cloudkms", true, args{ctx, apiv1.Options{Type: "cloudkms"}}, &cloudkms.CloudKMS{}, true}, // fails because not credentials
|
||||||
{"awskms", args{ctx, apiv1.Options{Type: "awskms"}}, nil, true}, // not yet supported
|
{"awskms", false, args{ctx, apiv1.Options{Type: "awskms"}}, nil, true}, // not yet supported
|
||||||
{"pkcs11", args{ctx, apiv1.Options{Type: "pkcs11"}}, nil, true}, // not yet supported
|
{"pkcs11", false, args{ctx, apiv1.Options{Type: "pkcs11"}}, nil, true}, // not yet supported
|
||||||
{"fail validation", args{ctx, apiv1.Options{Type: "foobar"}}, nil, true},
|
{"fail validation", false, args{ctx, apiv1.Options{Type: "foobar"}}, 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…
Reference in a new issue