|
|
|
@ -149,7 +149,7 @@ func TestAddRootCA(t *testing.T) {
|
|
|
|
|
t.Errorf("AddRootCA() error = %v", err)
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
if !reflect.DeepEqual(ctx.Config, tt.want) {
|
|
|
|
|
if !reflect.DeepEqual(ctx.Config, tt.want) && !equalPools(ctx.Config.RootCAs, tt.want.RootCAs) {
|
|
|
|
|
t.Errorf("AddRootCA() = %v, want %v", ctx.Config, tt.want)
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
@ -181,7 +181,7 @@ func TestAddClientCA(t *testing.T) {
|
|
|
|
|
t.Errorf("AddClientCA() error = %v", err)
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
if !reflect.DeepEqual(ctx.Config, tt.want) {
|
|
|
|
|
if !reflect.DeepEqual(ctx.Config, tt.want) && !equalPools(ctx.Config.ClientCAs, tt.want.ClientCAs) {
|
|
|
|
|
t.Errorf("AddClientCA() = %v, want %v", ctx.Config, tt.want)
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
@ -235,7 +235,7 @@ func TestAddRootsToRootCAs(t *testing.T) {
|
|
|
|
|
t.Errorf("AddRootsToRootCAs() error = %v, wantErr %v", err, tt.wantErr)
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
if !reflect.DeepEqual(ctx.Config.RootCAs, tt.want.RootCAs) {
|
|
|
|
|
if !equalPools(ctx.Config.RootCAs, tt.want.RootCAs) {
|
|
|
|
|
t.Errorf("AddRootsToRootCAs() = %v, want %v", ctx.Config, tt.want)
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
@ -289,7 +289,7 @@ func TestAddRootsToClientCAs(t *testing.T) {
|
|
|
|
|
t.Errorf("AddRootsToClientCAs() error = %v, wantErr %v", err, tt.wantErr)
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
if !reflect.DeepEqual(ctx.Config.ClientCAs, tt.want.ClientCAs) {
|
|
|
|
|
if !equalPools(ctx.Config.ClientCAs, tt.want.ClientCAs) {
|
|
|
|
|
t.Errorf("AddRootsToClientCAs() = %v, want %v", ctx.Config, tt.want)
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
@ -471,7 +471,7 @@ func TestAddRootsToCAs(t *testing.T) {
|
|
|
|
|
t.Errorf("AddRootsToCAs() error = %v, wantErr %v", err, tt.wantErr)
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
if !reflect.DeepEqual(ctx.Config.RootCAs, tt.want.RootCAs) || !reflect.DeepEqual(ctx.Config.ClientCAs, tt.want.ClientCAs) {
|
|
|
|
|
if !equalPools(ctx.Config.RootCAs, tt.want.RootCAs) || !equalPools(ctx.Config.ClientCAs, tt.want.ClientCAs) {
|
|
|
|
|
t.Errorf("AddRootsToCAs() = %v, want %v", ctx.Config, tt.want)
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
@ -543,6 +543,9 @@ func TestAddFederationToCAs(t *testing.T) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func equalPools(a, b *x509.CertPool) bool {
|
|
|
|
|
if reflect.DeepEqual(a, b) {
|
|
|
|
|
return true
|
|
|
|
|
}
|
|
|
|
|
subjects := a.Subjects()
|
|
|
|
|
sA := make([]string, len(subjects))
|
|
|
|
|
for i := range subjects {
|
|
|
|
|