mirror of
https://github.com/zitadel/zitadel.git
synced 2025-04-04 05:15:41 +00:00
fix: cherry pick fixes from master (#1339)
* fix: return api config in ApplicationView (#1330) (cherry picked from commit 16a47c65421e97d2151a76b3272efa598041e0ce) * fix tests
This commit is contained in:
parent
d8e42744b4
commit
438daebdb9
internal
operator
database/kinds
zitadel/kinds/iam/zitadel
ambassador
configuration
database
pkg/grpc/management/proto
@ -142,6 +142,13 @@ func oidcConfigFromApplicationViewModel(app *proj_model.ApplicationView) *manage
|
||||
}
|
||||
}
|
||||
|
||||
func apiConfigFromApplicationViewModel(app *proj_model.ApplicationView) *management.APIConfig {
|
||||
return &management.APIConfig{
|
||||
ClientId: app.OIDCClientID,
|
||||
AuthMethodType: apiAuthMethodTypeFromModel(proj_model.APIAuthMethodType(app.OIDCAuthMethodType)),
|
||||
}
|
||||
}
|
||||
|
||||
func complianceProblemsToLocalizedMessages(problems []string) []*message.LocalizedMessage {
|
||||
converted := make([]*message.LocalizedMessage, len(problems))
|
||||
for i, p := range problems {
|
||||
@ -326,6 +333,10 @@ func applicationViewFromModel(application *proj_model.ApplicationView) *manageme
|
||||
converted.AppConfig = &management.ApplicationView_OidcConfig{
|
||||
OidcConfig: oidcConfigFromApplicationViewModel(application),
|
||||
}
|
||||
} else {
|
||||
converted.AppConfig = &management.ApplicationView_ApiConfig{
|
||||
ApiConfig: apiConfigFromApplicationViewModel(application),
|
||||
}
|
||||
}
|
||||
return converted
|
||||
}
|
||||
|
@ -11,12 +11,12 @@ func CreateMockEncryptionAlg(ctrl *gomock.Controller) EncryptionAlgorithm {
|
||||
mCrypto.EXPECT().Algorithm().AnyTimes().Return("enc")
|
||||
mCrypto.EXPECT().EncryptionKeyID().AnyTimes().Return("id")
|
||||
mCrypto.EXPECT().DecryptionKeyIDs().AnyTimes().Return([]string{"id"})
|
||||
mCrypto.EXPECT().Encrypt(gomock.Any()).DoAndReturn(
|
||||
mCrypto.EXPECT().Encrypt(gomock.Any()).AnyTimes().DoAndReturn(
|
||||
func(code []byte) ([]byte, error) {
|
||||
return code, nil
|
||||
},
|
||||
)
|
||||
mCrypto.EXPECT().DecryptString(gomock.Any(), gomock.Any()).DoAndReturn(
|
||||
mCrypto.EXPECT().DecryptString(gomock.Any(), gomock.Any()).AnyTimes().DoAndReturn(
|
||||
func(code []byte, keyID string) (string, error) {
|
||||
if keyID != "id" {
|
||||
return "", errors.ThrowInternal(nil, "id", "invalid key id")
|
||||
@ -30,12 +30,12 @@ func CreateMockEncryptionAlg(ctrl *gomock.Controller) EncryptionAlgorithm {
|
||||
func CreateMockHashAlg(ctrl *gomock.Controller) HashAlgorithm {
|
||||
mCrypto := NewMockHashAlgorithm(ctrl)
|
||||
mCrypto.EXPECT().Algorithm().AnyTimes().Return("hash")
|
||||
mCrypto.EXPECT().Hash(gomock.Any()).DoAndReturn(
|
||||
mCrypto.EXPECT().Hash(gomock.Any()).AnyTimes().DoAndReturn(
|
||||
func(code []byte) ([]byte, error) {
|
||||
return code, nil
|
||||
},
|
||||
)
|
||||
mCrypto.EXPECT().CompareHash(gomock.Any(), gomock.Any()).DoAndReturn(
|
||||
mCrypto.EXPECT().CompareHash(gomock.Any(), gomock.Any()).AnyTimes().DoAndReturn(
|
||||
func(hashed, comparer []byte) error {
|
||||
if string(hashed) != string(comparer) {
|
||||
return errors.ThrowInternal(nil, "id", "invalid")
|
||||
|
@ -4,11 +4,11 @@ import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"github.com/caos/zitadel/internal/eventstore"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/caos/zitadel/internal/api/authz"
|
||||
"github.com/caos/zitadel/internal/eventstore"
|
||||
"github.com/caos/zitadel/internal/eventstore/repository"
|
||||
"github.com/caos/zitadel/internal/eventstore/repository/sql"
|
||||
)
|
||||
@ -30,7 +30,7 @@ func NewUserAggregate(id string) *eventstore.Aggregate {
|
||||
// ------------------------------------------------------------
|
||||
|
||||
type UserAddedEvent struct {
|
||||
eventstore.eventstore `json:"-"`
|
||||
eventstore.BaseEvent `json:"-"`
|
||||
|
||||
FirstName string `json:"firstName"`
|
||||
}
|
||||
|
@ -35,7 +35,7 @@ func SetInstantBackup(
|
||||
},
|
||||
StringData: map[string]string{secretKey: saJson},
|
||||
Type: "Opaque",
|
||||
}).Times(1).Return(nil)
|
||||
}).MinTimes(1).MaxTimes(1).Return(nil)
|
||||
|
||||
k8sClient.EXPECT().ApplyJob(gomock.Any()).Times(1).Return(nil)
|
||||
k8sClient.EXPECT().GetJob(namespace, backup.GetJobName(backupName)).Times(1).Return(nil, macherrs.NewNotFound(schema.GroupResource{"batch", "jobs"}, backup.GetJobName(backupName)))
|
||||
@ -57,7 +57,7 @@ func SetBackup(
|
||||
},
|
||||
StringData: map[string]string{secretKey: saJson},
|
||||
Type: "Opaque",
|
||||
}).Times(1).Return(nil)
|
||||
}).MinTimes(1).MaxTimes(1).Return(nil)
|
||||
k8sClient.EXPECT().ApplyCronJob(gomock.Any()).Times(1).Return(nil)
|
||||
}
|
||||
|
||||
@ -88,7 +88,7 @@ func SetRestore(
|
||||
},
|
||||
StringData: map[string]string{secretKey: saJson},
|
||||
Type: "Opaque",
|
||||
}).Times(1).Return(nil)
|
||||
}).MinTimes(1).MaxTimes(1).Return(nil)
|
||||
|
||||
k8sClient.EXPECT().ApplyJob(gomock.Any()).Times(1).Return(nil)
|
||||
k8sClient.EXPECT().GetJob(namespace, restore.GetJobName(backupName)).Times(1).Return(nil, macherrs.NewNotFound(schema.GroupResource{"batch", "jobs"}, restore.GetJobName(backupName)))
|
||||
|
@ -106,31 +106,31 @@ func TestManaged_Adapt1(t *testing.T) {
|
||||
}
|
||||
|
||||
k8sClient.EXPECT().ApplyService(gomock.Any()).Times(3)
|
||||
k8sClient.EXPECT().ApplyServiceAccount(gomock.Any()).Times(1)
|
||||
k8sClient.EXPECT().ApplyRole(gomock.Any()).Times(1)
|
||||
k8sClient.EXPECT().ApplyClusterRole(gomock.Any()).Times(1)
|
||||
k8sClient.EXPECT().ApplyRoleBinding(gomock.Any()).Times(1)
|
||||
k8sClient.EXPECT().ApplyClusterRoleBinding(gomock.Any()).Times(1)
|
||||
k8sClient.EXPECT().ApplyServiceAccount(gomock.Any()).MinTimes(1).MaxTimes(1)
|
||||
k8sClient.EXPECT().ApplyRole(gomock.Any()).MinTimes(1).MaxTimes(1)
|
||||
k8sClient.EXPECT().ApplyClusterRole(gomock.Any()).MinTimes(1).MaxTimes(1)
|
||||
k8sClient.EXPECT().ApplyRoleBinding(gomock.Any()).MinTimes(1).MaxTimes(1)
|
||||
k8sClient.EXPECT().ApplyClusterRoleBinding(gomock.Any()).MinTimes(1).MaxTimes(1)
|
||||
//statefulset
|
||||
k8sClient.EXPECT().ApplyStatefulSet(gomock.Any(), gomock.Any()).Times(1)
|
||||
k8sClient.EXPECT().ApplyStatefulSet(gomock.Any(), gomock.Any()).MinTimes(1).MaxTimes(1)
|
||||
//running for setup
|
||||
k8sClient.EXPECT().WaitUntilStatefulsetIsReady(namespace, SfsName, true, false, time.Duration(60))
|
||||
k8sClient.EXPECT().WaitUntilStatefulsetIsReady(namespace, SfsName, true, false, time.Duration(60)).MinTimes(1).MaxTimes(1)
|
||||
//not ready for setup
|
||||
k8sClient.EXPECT().WaitUntilStatefulsetIsReady(namespace, SfsName, true, true, time.Duration(1))
|
||||
k8sClient.EXPECT().WaitUntilStatefulsetIsReady(namespace, SfsName, true, true, time.Duration(1)).MinTimes(1).MaxTimes(1)
|
||||
//ready after setup
|
||||
k8sClient.EXPECT().WaitUntilStatefulsetIsReady(namespace, SfsName, true, true, time.Duration(60))
|
||||
k8sClient.EXPECT().WaitUntilStatefulsetIsReady(namespace, SfsName, true, true, time.Duration(60)).MinTimes(1).MaxTimes(1)
|
||||
//client
|
||||
k8sClient.EXPECT().ListSecrets(namespace, nodeLabels).Times(1).Return(secretList, nil)
|
||||
dbCurrent.EXPECT().GetCertificate().Times(1).Return(nil)
|
||||
dbCurrent.EXPECT().GetCertificateKey().Times(1).Return(nil)
|
||||
k8sClient.EXPECT().ApplySecret(gomock.Any()).Times(1)
|
||||
k8sClient.EXPECT().ListSecrets(namespace, nodeLabels).MinTimes(1).MaxTimes(1).Return(secretList, nil)
|
||||
dbCurrent.EXPECT().GetCertificate().MinTimes(1).MaxTimes(1).Return(nil)
|
||||
dbCurrent.EXPECT().GetCertificateKey().MinTimes(1).MaxTimes(1).Return(nil)
|
||||
k8sClient.EXPECT().ApplySecret(gomock.Any()).MinTimes(1).MaxTimes(1)
|
||||
//node
|
||||
k8sClient.EXPECT().ListSecrets(namespace, nodeLabels).Times(1).Return(secretList, nil)
|
||||
dbCurrent.EXPECT().GetCertificate().Times(1).Return(nil)
|
||||
dbCurrent.EXPECT().GetCertificateKey().Times(1).Return(nil)
|
||||
dbCurrent.EXPECT().SetCertificate(gomock.Any()).Times(1)
|
||||
dbCurrent.EXPECT().SetCertificateKey(gomock.Any()).Times(1)
|
||||
k8sClient.EXPECT().ApplySecret(gomock.Any()).Times(1)
|
||||
k8sClient.EXPECT().ListSecrets(namespace, nodeLabels).MinTimes(1).MaxTimes(1).Return(secretList, nil)
|
||||
dbCurrent.EXPECT().GetCertificate().MinTimes(1).MaxTimes(1).Return(nil)
|
||||
dbCurrent.EXPECT().GetCertificateKey().MinTimes(1).MaxTimes(1).Return(nil)
|
||||
dbCurrent.EXPECT().SetCertificate(gomock.Any()).MinTimes(1).MaxTimes(1)
|
||||
dbCurrent.EXPECT().SetCertificateKey(gomock.Any()).MinTimes(1).MaxTimes(1)
|
||||
k8sClient.EXPECT().ApplySecret(gomock.Any()).MinTimes(1).MaxTimes(1)
|
||||
|
||||
query, _, _, err := AdaptFunc(componentLabels, namespace, timestamp, nodeselector, tolerations, version, features)(monitor, desired, &tree.Tree{})
|
||||
assert.NoError(t, err)
|
||||
@ -218,31 +218,31 @@ func TestManaged_Adapt2(t *testing.T) {
|
||||
}
|
||||
|
||||
k8sClient.EXPECT().ApplyService(gomock.Any()).Times(3)
|
||||
k8sClient.EXPECT().ApplyServiceAccount(gomock.Any()).Times(1)
|
||||
k8sClient.EXPECT().ApplyRole(gomock.Any()).Times(1)
|
||||
k8sClient.EXPECT().ApplyClusterRole(gomock.Any()).Times(1)
|
||||
k8sClient.EXPECT().ApplyRoleBinding(gomock.Any()).Times(1)
|
||||
k8sClient.EXPECT().ApplyClusterRoleBinding(gomock.Any()).Times(1)
|
||||
k8sClient.EXPECT().ApplyServiceAccount(gomock.Any()).MinTimes(1).MaxTimes(1)
|
||||
k8sClient.EXPECT().ApplyRole(gomock.Any()).MinTimes(1).MaxTimes(1)
|
||||
k8sClient.EXPECT().ApplyClusterRole(gomock.Any()).MinTimes(1).MaxTimes(1)
|
||||
k8sClient.EXPECT().ApplyRoleBinding(gomock.Any()).MinTimes(1).MaxTimes(1)
|
||||
k8sClient.EXPECT().ApplyClusterRoleBinding(gomock.Any()).MinTimes(1).MaxTimes(1)
|
||||
//statefulset
|
||||
k8sClient.EXPECT().ApplyStatefulSet(gomock.Any(), gomock.Any()).Times(1)
|
||||
k8sClient.EXPECT().ApplyStatefulSet(gomock.Any(), gomock.Any()).MinTimes(1).MaxTimes(1)
|
||||
//running for setup
|
||||
k8sClient.EXPECT().WaitUntilStatefulsetIsReady(namespace, SfsName, true, false, time.Duration(60))
|
||||
k8sClient.EXPECT().WaitUntilStatefulsetIsReady(namespace, SfsName, true, false, time.Duration(60)).MinTimes(1).MaxTimes(1)
|
||||
//not ready for setup
|
||||
k8sClient.EXPECT().WaitUntilStatefulsetIsReady(namespace, SfsName, true, true, time.Duration(1))
|
||||
k8sClient.EXPECT().WaitUntilStatefulsetIsReady(namespace, SfsName, true, true, time.Duration(1)).MinTimes(1).MaxTimes(1)
|
||||
//ready after setup
|
||||
k8sClient.EXPECT().WaitUntilStatefulsetIsReady(namespace, SfsName, true, true, time.Duration(60))
|
||||
k8sClient.EXPECT().WaitUntilStatefulsetIsReady(namespace, SfsName, true, true, time.Duration(60)).MinTimes(1).MaxTimes(1)
|
||||
//client
|
||||
k8sClient.EXPECT().ListSecrets(namespace, nodeLabels).Times(1).Return(secretList, nil)
|
||||
dbCurrent.EXPECT().GetCertificate().Times(1).Return(nil)
|
||||
dbCurrent.EXPECT().GetCertificateKey().Times(1).Return(nil)
|
||||
k8sClient.EXPECT().ApplySecret(gomock.Any()).Times(1)
|
||||
k8sClient.EXPECT().ListSecrets(namespace, nodeLabels).MinTimes(1).MaxTimes(1).Return(secretList, nil)
|
||||
dbCurrent.EXPECT().GetCertificate().MinTimes(1).MaxTimes(1).Return(nil)
|
||||
dbCurrent.EXPECT().GetCertificateKey().MinTimes(1).MaxTimes(1).Return(nil)
|
||||
k8sClient.EXPECT().ApplySecret(gomock.Any()).MinTimes(1).MaxTimes(1)
|
||||
//node
|
||||
k8sClient.EXPECT().ListSecrets(namespace, nodeLabels).Times(1).Return(secretList, nil)
|
||||
dbCurrent.EXPECT().GetCertificate().Times(1).Return(nil)
|
||||
dbCurrent.EXPECT().GetCertificateKey().Times(1).Return(nil)
|
||||
dbCurrent.EXPECT().SetCertificate(gomock.Any()).Times(1)
|
||||
dbCurrent.EXPECT().SetCertificateKey(gomock.Any()).Times(1)
|
||||
k8sClient.EXPECT().ApplySecret(gomock.Any()).Times(1)
|
||||
k8sClient.EXPECT().ListSecrets(namespace, nodeLabels).MinTimes(1).MaxTimes(1).Return(secretList, nil)
|
||||
dbCurrent.EXPECT().GetCertificate().MinTimes(1).MaxTimes(1).Return(nil)
|
||||
dbCurrent.EXPECT().GetCertificateKey().MinTimes(1).MaxTimes(1).Return(nil)
|
||||
dbCurrent.EXPECT().SetCertificate(gomock.Any()).MinTimes(1).MaxTimes(1)
|
||||
dbCurrent.EXPECT().SetCertificateKey(gomock.Any()).MinTimes(1).MaxTimes(1)
|
||||
k8sClient.EXPECT().ApplySecret(gomock.Any()).MinTimes(1).MaxTimes(1)
|
||||
|
||||
query, _, _, err := AdaptFunc(componentLabels, namespace, timestamp, nodeselector, tolerations, version, features)(monitor, desired, &tree.Tree{})
|
||||
assert.NoError(t, err)
|
||||
|
@ -33,7 +33,7 @@ func SetReturnResourceVersion(
|
||||
},
|
||||
},
|
||||
}
|
||||
k8sClient.EXPECT().GetNamespacedCRDResource(group, version, kind, namespace, name).Return(ret, nil)
|
||||
k8sClient.EXPECT().GetNamespacedCRDResource(group, version, kind, namespace, name).MinTimes(1).MaxTimes(1).Return(ret, nil)
|
||||
}
|
||||
|
||||
func SetMappingsUI(
|
||||
@ -43,12 +43,12 @@ func SetMappingsUI(
|
||||
group := "getambassador.io"
|
||||
version := "v2"
|
||||
kind := "Mapping"
|
||||
k8sClient.EXPECT().CheckCRD("mappings.getambassador.io").Times(1).Return(&apixv1beta1.CustomResourceDefinition{}, nil)
|
||||
k8sClient.EXPECT().CheckCRD("mappings.getambassador.io").MinTimes(1).MaxTimes(1).Return(&apixv1beta1.CustomResourceDefinition{}, nil)
|
||||
|
||||
SetReturnResourceVersion(k8sClient, group, version, kind, namespace, ui.AccountsName, "")
|
||||
k8sClient.EXPECT().ApplyNamespacedCRDResource(group, version, kind, namespace, ui.AccountsName, gomock.Any()).Times(1)
|
||||
k8sClient.EXPECT().ApplyNamespacedCRDResource(group, version, kind, namespace, ui.AccountsName, gomock.Any()).MinTimes(1).MaxTimes(1)
|
||||
SetReturnResourceVersion(k8sClient, group, version, kind, namespace, ui.ConsoleName, "")
|
||||
k8sClient.EXPECT().ApplyNamespacedCRDResource(group, version, kind, namespace, ui.ConsoleName, gomock.Any()).Times(1)
|
||||
k8sClient.EXPECT().ApplyNamespacedCRDResource(group, version, kind, namespace, ui.ConsoleName, gomock.Any()).MinTimes(1).MaxTimes(1)
|
||||
}
|
||||
|
||||
func SetMappingsHTTP(
|
||||
@ -58,22 +58,22 @@ func SetMappingsHTTP(
|
||||
group := "getambassador.io"
|
||||
version := "v2"
|
||||
kind := "Mapping"
|
||||
k8sClient.EXPECT().CheckCRD("mappings.getambassador.io").Times(1).Return(&apixv1beta1.CustomResourceDefinition{}, nil)
|
||||
k8sClient.EXPECT().CheckCRD("mappings.getambassador.io").MinTimes(1).MaxTimes(1).Return(&apixv1beta1.CustomResourceDefinition{}, nil)
|
||||
|
||||
SetReturnResourceVersion(k8sClient, group, version, kind, namespace, http.AdminRName, "")
|
||||
k8sClient.EXPECT().ApplyNamespacedCRDResource(group, version, kind, namespace, http.AdminRName, gomock.Any()).Times(1)
|
||||
k8sClient.EXPECT().ApplyNamespacedCRDResource(group, version, kind, namespace, http.AdminRName, gomock.Any()).MinTimes(1).MaxTimes(1)
|
||||
SetReturnResourceVersion(k8sClient, group, version, kind, namespace, http.AuthorizeName, "")
|
||||
k8sClient.EXPECT().ApplyNamespacedCRDResource(group, version, kind, namespace, http.AuthorizeName, gomock.Any()).Times(1)
|
||||
k8sClient.EXPECT().ApplyNamespacedCRDResource(group, version, kind, namespace, http.AuthorizeName, gomock.Any()).MinTimes(1).MaxTimes(1)
|
||||
SetReturnResourceVersion(k8sClient, group, version, kind, namespace, http.AuthRName, "")
|
||||
k8sClient.EXPECT().ApplyNamespacedCRDResource(group, version, kind, namespace, http.AuthRName, gomock.Any()).Times(1)
|
||||
k8sClient.EXPECT().ApplyNamespacedCRDResource(group, version, kind, namespace, http.AuthRName, gomock.Any()).MinTimes(1).MaxTimes(1)
|
||||
SetReturnResourceVersion(k8sClient, group, version, kind, namespace, http.EndsessionName, "")
|
||||
k8sClient.EXPECT().ApplyNamespacedCRDResource(group, version, kind, namespace, http.EndsessionName, gomock.Any()).Times(1)
|
||||
k8sClient.EXPECT().ApplyNamespacedCRDResource(group, version, kind, namespace, http.EndsessionName, gomock.Any()).MinTimes(1).MaxTimes(1)
|
||||
SetReturnResourceVersion(k8sClient, group, version, kind, namespace, http.IssuerName, "")
|
||||
k8sClient.EXPECT().ApplyNamespacedCRDResource(group, version, kind, namespace, http.IssuerName, gomock.Any()).Times(1)
|
||||
k8sClient.EXPECT().ApplyNamespacedCRDResource(group, version, kind, namespace, http.IssuerName, gomock.Any()).MinTimes(1).MaxTimes(1)
|
||||
SetReturnResourceVersion(k8sClient, group, version, kind, namespace, http.MgmtName, "")
|
||||
k8sClient.EXPECT().ApplyNamespacedCRDResource(group, version, kind, namespace, http.MgmtName, gomock.Any()).Times(1)
|
||||
k8sClient.EXPECT().ApplyNamespacedCRDResource(group, version, kind, namespace, http.MgmtName, gomock.Any()).MinTimes(1).MaxTimes(1)
|
||||
SetReturnResourceVersion(k8sClient, group, version, kind, namespace, http.OauthName, "")
|
||||
k8sClient.EXPECT().ApplyNamespacedCRDResource(group, version, kind, namespace, http.OauthName, gomock.Any()).Times(1)
|
||||
k8sClient.EXPECT().ApplyNamespacedCRDResource(group, version, kind, namespace, http.OauthName, gomock.Any()).MinTimes(1).MaxTimes(1)
|
||||
}
|
||||
|
||||
func SetMappingsGRPC(
|
||||
@ -83,14 +83,14 @@ func SetMappingsGRPC(
|
||||
group := "getambassador.io"
|
||||
version := "v2"
|
||||
kind := "Mapping"
|
||||
k8sClient.EXPECT().CheckCRD("mappings.getambassador.io").Times(1).Return(&apixv1beta1.CustomResourceDefinition{}, nil)
|
||||
k8sClient.EXPECT().CheckCRD("mappings.getambassador.io").MinTimes(1).MaxTimes(1).Return(&apixv1beta1.CustomResourceDefinition{}, nil)
|
||||
|
||||
SetReturnResourceVersion(k8sClient, group, version, kind, namespace, grpc.AdminMName, "")
|
||||
k8sClient.EXPECT().ApplyNamespacedCRDResource(group, version, kind, namespace, grpc.AdminMName, gomock.Any()).Times(1)
|
||||
k8sClient.EXPECT().ApplyNamespacedCRDResource(group, version, kind, namespace, grpc.AdminMName, gomock.Any()).MinTimes(1).MaxTimes(1)
|
||||
SetReturnResourceVersion(k8sClient, group, version, kind, namespace, grpc.AuthMName, "")
|
||||
k8sClient.EXPECT().ApplyNamespacedCRDResource(group, version, kind, namespace, grpc.AuthMName, gomock.Any()).Times(1)
|
||||
k8sClient.EXPECT().ApplyNamespacedCRDResource(group, version, kind, namespace, grpc.AuthMName, gomock.Any()).MinTimes(1).MaxTimes(1)
|
||||
SetReturnResourceVersion(k8sClient, group, version, kind, namespace, grpc.MgmtMName, "")
|
||||
k8sClient.EXPECT().ApplyNamespacedCRDResource(group, version, kind, namespace, grpc.MgmtMName, gomock.Any()).Times(1)
|
||||
k8sClient.EXPECT().ApplyNamespacedCRDResource(group, version, kind, namespace, grpc.MgmtMName, gomock.Any()).MinTimes(1).MaxTimes(1)
|
||||
}
|
||||
|
||||
func SetHosts(
|
||||
@ -100,16 +100,16 @@ func SetHosts(
|
||||
group := "getambassador.io"
|
||||
version := "v2"
|
||||
kind := "Host"
|
||||
k8sClient.EXPECT().CheckCRD("hosts.getambassador.io").Times(1).Return(&apixv1beta1.CustomResourceDefinition{}, nil)
|
||||
k8sClient.EXPECT().CheckCRD("hosts.getambassador.io").MinTimes(1).MaxTimes(1).Return(&apixv1beta1.CustomResourceDefinition{}, nil)
|
||||
|
||||
SetReturnResourceVersion(k8sClient, group, version, kind, namespace, hosts.AccountsHostName, "")
|
||||
k8sClient.EXPECT().ApplyNamespacedCRDResource(group, version, kind, namespace, hosts.AccountsHostName, gomock.Any()).Times(1)
|
||||
k8sClient.EXPECT().ApplyNamespacedCRDResource(group, version, kind, namespace, hosts.AccountsHostName, gomock.Any()).MinTimes(1).MaxTimes(1)
|
||||
SetReturnResourceVersion(k8sClient, group, version, kind, namespace, hosts.ApiHostName, "")
|
||||
k8sClient.EXPECT().ApplyNamespacedCRDResource(group, version, kind, namespace, hosts.ApiHostName, gomock.Any()).Times(1)
|
||||
k8sClient.EXPECT().ApplyNamespacedCRDResource(group, version, kind, namespace, hosts.ApiHostName, gomock.Any()).MinTimes(1).MaxTimes(1)
|
||||
SetReturnResourceVersion(k8sClient, group, version, kind, namespace, hosts.ConsoleHostName, "")
|
||||
k8sClient.EXPECT().ApplyNamespacedCRDResource(group, version, kind, namespace, hosts.ConsoleHostName, gomock.Any()).Times(1)
|
||||
k8sClient.EXPECT().ApplyNamespacedCRDResource(group, version, kind, namespace, hosts.ConsoleHostName, gomock.Any()).MinTimes(1).MaxTimes(1)
|
||||
SetReturnResourceVersion(k8sClient, group, version, kind, namespace, hosts.IssuerHostName, "")
|
||||
k8sClient.EXPECT().ApplyNamespacedCRDResource(group, version, kind, namespace, hosts.IssuerHostName, gomock.Any()).Times(1)
|
||||
k8sClient.EXPECT().ApplyNamespacedCRDResource(group, version, kind, namespace, hosts.IssuerHostName, gomock.Any()).MinTimes(1).MaxTimes(1)
|
||||
|
||||
}
|
||||
|
||||
|
@ -31,7 +31,7 @@ func SetReturnResourceVersion(
|
||||
},
|
||||
},
|
||||
}
|
||||
k8sClient.EXPECT().GetNamespacedCRDResource(group, version, kind, namespace, name).Return(ret, nil)
|
||||
k8sClient.EXPECT().GetNamespacedCRDResource(group, version, kind, namespace, name).MinTimes(1).MaxTimes(1).Return(ret, nil)
|
||||
}
|
||||
|
||||
func TestGrpc_Adapt(t *testing.T) {
|
||||
@ -53,7 +53,7 @@ func TestGrpc_Adapt(t *testing.T) {
|
||||
|
||||
k8sClient := kubernetesmock.NewMockClientInt(gomock.NewController(t))
|
||||
|
||||
k8sClient.EXPECT().CheckCRD("mappings.getambassador.io").Times(1).Return(&apixv1beta1.CustomResourceDefinition{}, nil)
|
||||
k8sClient.EXPECT().CheckCRD("mappings.getambassador.io").MinTimes(1).MaxTimes(1).Return(&apixv1beta1.CustomResourceDefinition{}, nil)
|
||||
|
||||
group := "getambassador.io"
|
||||
version := "v2"
|
||||
@ -90,7 +90,7 @@ func TestGrpc_Adapt(t *testing.T) {
|
||||
},
|
||||
}
|
||||
SetReturnResourceVersion(k8sClient, group, version, kind, namespace, AdminMName, "")
|
||||
k8sClient.EXPECT().ApplyNamespacedCRDResource(group, version, kind, namespace, AdminMName, adminM).Times(1)
|
||||
k8sClient.EXPECT().ApplyNamespacedCRDResource(group, version, kind, namespace, AdminMName, adminM).MinTimes(1).MaxTimes(1)
|
||||
|
||||
authMName := labels.MustForName(componentLabels, AuthMName)
|
||||
authM := &unstructured.Unstructured{
|
||||
@ -115,7 +115,7 @@ func TestGrpc_Adapt(t *testing.T) {
|
||||
},
|
||||
}
|
||||
SetReturnResourceVersion(k8sClient, group, version, kind, namespace, AuthMName, "")
|
||||
k8sClient.EXPECT().ApplyNamespacedCRDResource(group, version, kind, namespace, AuthMName, authM).Times(1)
|
||||
k8sClient.EXPECT().ApplyNamespacedCRDResource(group, version, kind, namespace, AuthMName, authM).MinTimes(1).MaxTimes(1)
|
||||
|
||||
mgmtMName := labels.MustForName(componentLabels, MgmtMName)
|
||||
mgmtM := &unstructured.Unstructured{
|
||||
@ -140,7 +140,7 @@ func TestGrpc_Adapt(t *testing.T) {
|
||||
},
|
||||
}
|
||||
SetReturnResourceVersion(k8sClient, group, version, kind, namespace, MgmtMName, "")
|
||||
k8sClient.EXPECT().ApplyNamespacedCRDResource(group, version, kind, namespace, MgmtMName, mgmtM).Times(1)
|
||||
k8sClient.EXPECT().ApplyNamespacedCRDResource(group, version, kind, namespace, MgmtMName, mgmtM).MinTimes(1).MaxTimes(1)
|
||||
|
||||
query, _, err := AdaptFunc(monitor, componentLabels, namespace, url, dns)
|
||||
assert.NoError(t, err)
|
||||
@ -169,7 +169,7 @@ func TestGrpc_Adapt2(t *testing.T) {
|
||||
|
||||
k8sClient := kubernetesmock.NewMockClientInt(gomock.NewController(t))
|
||||
|
||||
k8sClient.EXPECT().CheckCRD("mappings.getambassador.io").Times(1).Return(&apixv1beta1.CustomResourceDefinition{}, nil)
|
||||
k8sClient.EXPECT().CheckCRD("mappings.getambassador.io").MinTimes(1).MaxTimes(1).Return(&apixv1beta1.CustomResourceDefinition{}, nil)
|
||||
|
||||
group := "getambassador.io"
|
||||
version := "v2"
|
||||
@ -207,7 +207,7 @@ func TestGrpc_Adapt2(t *testing.T) {
|
||||
},
|
||||
}
|
||||
SetReturnResourceVersion(k8sClient, group, version, kind, namespace, AdminMName, "")
|
||||
k8sClient.EXPECT().ApplyNamespacedCRDResource(group, version, kind, namespace, AdminMName, adminM).Times(1)
|
||||
k8sClient.EXPECT().ApplyNamespacedCRDResource(group, version, kind, namespace, AdminMName, adminM).MinTimes(1).MaxTimes(1)
|
||||
|
||||
authMName := labels.MustForName(componentLabels, AuthMName)
|
||||
authM := &unstructured.Unstructured{
|
||||
@ -232,7 +232,7 @@ func TestGrpc_Adapt2(t *testing.T) {
|
||||
},
|
||||
}
|
||||
SetReturnResourceVersion(k8sClient, group, version, kind, namespace, AuthMName, "")
|
||||
k8sClient.EXPECT().ApplyNamespacedCRDResource(group, version, kind, namespace, AuthMName, authM).Times(1)
|
||||
k8sClient.EXPECT().ApplyNamespacedCRDResource(group, version, kind, namespace, AuthMName, authM).MinTimes(1).MaxTimes(1)
|
||||
|
||||
mgmtMName := labels.MustForName(componentLabels, MgmtMName)
|
||||
mgmtM := &unstructured.Unstructured{
|
||||
@ -257,7 +257,7 @@ func TestGrpc_Adapt2(t *testing.T) {
|
||||
},
|
||||
}
|
||||
SetReturnResourceVersion(k8sClient, group, version, kind, namespace, MgmtMName, "")
|
||||
k8sClient.EXPECT().ApplyNamespacedCRDResource(group, version, kind, namespace, MgmtMName, mgmtM).Times(1)
|
||||
k8sClient.EXPECT().ApplyNamespacedCRDResource(group, version, kind, namespace, MgmtMName, mgmtM).MinTimes(1).MaxTimes(1)
|
||||
|
||||
query, _, err := AdaptFunc(monitor, componentLabels, namespace, url, dns)
|
||||
assert.NoError(t, err)
|
||||
|
@ -30,7 +30,7 @@ func SetReturnResourceVersion(
|
||||
},
|
||||
},
|
||||
}
|
||||
k8sClient.EXPECT().GetNamespacedCRDResource(group, version, kind, namespace, name).Return(ret, nil)
|
||||
k8sClient.EXPECT().GetNamespacedCRDResource(group, version, kind, namespace, name).MinTimes(1).MaxTimes(1).Return(ret, nil)
|
||||
}
|
||||
|
||||
func TestHosts_AdaptFunc(t *testing.T) {
|
||||
@ -52,7 +52,7 @@ func TestHosts_AdaptFunc(t *testing.T) {
|
||||
|
||||
k8sClient := kubernetesmock.NewMockClientInt(gomock.NewController(t))
|
||||
|
||||
k8sClient.EXPECT().CheckCRD("hosts.getambassador.io").Times(1).Return(&apixv1beta1.CustomResourceDefinition{}, nil)
|
||||
k8sClient.EXPECT().CheckCRD("hosts.getambassador.io").MinTimes(1).MaxTimes(1).Return(&apixv1beta1.CustomResourceDefinition{}, nil)
|
||||
|
||||
group := "getambassador.io"
|
||||
version := "v2"
|
||||
@ -91,7 +91,7 @@ func TestHosts_AdaptFunc(t *testing.T) {
|
||||
}}
|
||||
|
||||
SetReturnResourceVersion(k8sClient, group, version, kind, namespace, IssuerHostName, "")
|
||||
k8sClient.EXPECT().ApplyNamespacedCRDResource(group, version, kind, namespace, IssuerHostName, issuerHost).Times(1)
|
||||
k8sClient.EXPECT().ApplyNamespacedCRDResource(group, version, kind, namespace, IssuerHostName, issuerHost).MinTimes(1).MaxTimes(1)
|
||||
|
||||
consoleHostName := labels.MustForName(componentLabels, ConsoleHostName)
|
||||
consoleHost := &unstructured.Unstructured{
|
||||
@ -126,7 +126,7 @@ func TestHosts_AdaptFunc(t *testing.T) {
|
||||
}}
|
||||
|
||||
SetReturnResourceVersion(k8sClient, group, version, kind, namespace, ConsoleHostName, "")
|
||||
k8sClient.EXPECT().ApplyNamespacedCRDResource(group, version, kind, namespace, ConsoleHostName, consoleHost).Times(1)
|
||||
k8sClient.EXPECT().ApplyNamespacedCRDResource(group, version, kind, namespace, ConsoleHostName, consoleHost).MinTimes(1).MaxTimes(1)
|
||||
|
||||
apiHostName := labels.MustForName(componentLabels, ApiHostName)
|
||||
apiHost := &unstructured.Unstructured{
|
||||
@ -161,7 +161,7 @@ func TestHosts_AdaptFunc(t *testing.T) {
|
||||
}}
|
||||
|
||||
SetReturnResourceVersion(k8sClient, group, version, kind, namespace, ApiHostName, "")
|
||||
k8sClient.EXPECT().ApplyNamespacedCRDResource(group, version, kind, namespace, ApiHostName, apiHost).Times(1)
|
||||
k8sClient.EXPECT().ApplyNamespacedCRDResource(group, version, kind, namespace, ApiHostName, apiHost).MinTimes(1).MaxTimes(1)
|
||||
|
||||
accountsHostName := labels.MustForName(componentLabels, AccountsHostName)
|
||||
accountsHost := &unstructured.Unstructured{
|
||||
@ -196,7 +196,7 @@ func TestHosts_AdaptFunc(t *testing.T) {
|
||||
}}
|
||||
|
||||
SetReturnResourceVersion(k8sClient, group, version, kind, namespace, AccountsHostName, "")
|
||||
k8sClient.EXPECT().ApplyNamespacedCRDResource(group, version, kind, namespace, AccountsHostName, accountsHost).Times(1)
|
||||
k8sClient.EXPECT().ApplyNamespacedCRDResource(group, version, kind, namespace, AccountsHostName, accountsHost).MinTimes(1).MaxTimes(1)
|
||||
|
||||
query, _, err := AdaptFunc(monitor, componentLabels, namespace, dns)
|
||||
assert.NoError(t, err)
|
||||
@ -224,7 +224,7 @@ func TestHosts_AdaptFunc2(t *testing.T) {
|
||||
|
||||
k8sClient := kubernetesmock.NewMockClientInt(gomock.NewController(t))
|
||||
|
||||
k8sClient.EXPECT().CheckCRD("hosts.getambassador.io").Times(1).Return(&apixv1beta1.CustomResourceDefinition{}, nil)
|
||||
k8sClient.EXPECT().CheckCRD("hosts.getambassador.io").MinTimes(1).MaxTimes(1).Return(&apixv1beta1.CustomResourceDefinition{}, nil)
|
||||
|
||||
group := "getambassador.io"
|
||||
version := "v2"
|
||||
@ -263,7 +263,7 @@ func TestHosts_AdaptFunc2(t *testing.T) {
|
||||
}}
|
||||
|
||||
SetReturnResourceVersion(k8sClient, group, version, kind, namespace, IssuerHostName, "")
|
||||
k8sClient.EXPECT().ApplyNamespacedCRDResource(group, version, kind, namespace, IssuerHostName, issuerHost).Times(1)
|
||||
k8sClient.EXPECT().ApplyNamespacedCRDResource(group, version, kind, namespace, IssuerHostName, issuerHost).MinTimes(1).MaxTimes(1)
|
||||
|
||||
consoleHostName := labels.MustForName(componentLabels, ConsoleHostName)
|
||||
consoleHost := &unstructured.Unstructured{
|
||||
@ -298,7 +298,7 @@ func TestHosts_AdaptFunc2(t *testing.T) {
|
||||
}}
|
||||
|
||||
SetReturnResourceVersion(k8sClient, group, version, kind, namespace, ConsoleHostName, "")
|
||||
k8sClient.EXPECT().ApplyNamespacedCRDResource(group, version, kind, namespace, ConsoleHostName, consoleHost).Times(1)
|
||||
k8sClient.EXPECT().ApplyNamespacedCRDResource(group, version, kind, namespace, ConsoleHostName, consoleHost).MinTimes(1).MaxTimes(1)
|
||||
|
||||
apiHostName := labels.MustForName(componentLabels, ApiHostName)
|
||||
apiHost := &unstructured.Unstructured{
|
||||
@ -333,7 +333,7 @@ func TestHosts_AdaptFunc2(t *testing.T) {
|
||||
}}
|
||||
|
||||
SetReturnResourceVersion(k8sClient, group, version, kind, namespace, ApiHostName, "")
|
||||
k8sClient.EXPECT().ApplyNamespacedCRDResource(group, version, kind, namespace, ApiHostName, apiHost).Times(1)
|
||||
k8sClient.EXPECT().ApplyNamespacedCRDResource(group, version, kind, namespace, ApiHostName, apiHost).MinTimes(1).MaxTimes(1)
|
||||
|
||||
accountsHostName := labels.MustForName(componentLabels, AccountsHostName)
|
||||
accountsHost := &unstructured.Unstructured{
|
||||
@ -368,7 +368,7 @@ func TestHosts_AdaptFunc2(t *testing.T) {
|
||||
}}
|
||||
|
||||
SetReturnResourceVersion(k8sClient, group, version, kind, namespace, AccountsHostName, "")
|
||||
k8sClient.EXPECT().ApplyNamespacedCRDResource(group, version, kind, namespace, AccountsHostName, accountsHost).Times(1)
|
||||
k8sClient.EXPECT().ApplyNamespacedCRDResource(group, version, kind, namespace, AccountsHostName, accountsHost).MinTimes(1).MaxTimes(1)
|
||||
|
||||
query, _, err := AdaptFunc(monitor, componentLabels, namespace, dns)
|
||||
assert.NoError(t, err)
|
||||
|
@ -30,7 +30,7 @@ func SetReturnResourceVersion(
|
||||
},
|
||||
},
|
||||
}
|
||||
k8sClient.EXPECT().GetNamespacedCRDResource(group, version, kind, namespace, name).Return(ret, nil)
|
||||
k8sClient.EXPECT().GetNamespacedCRDResource(group, version, kind, namespace, name).MinTimes(1).MaxTimes(1).Return(ret, nil)
|
||||
}
|
||||
|
||||
func TestHttp_Adapt(t *testing.T) {
|
||||
@ -49,7 +49,7 @@ func TestHttp_Adapt(t *testing.T) {
|
||||
}
|
||||
k8sClient := kubernetesmock.NewMockClientInt(gomock.NewController(t))
|
||||
|
||||
k8sClient.EXPECT().CheckCRD("mappings.getambassador.io").Times(1).Return(&apixv1beta1.CustomResourceDefinition{}, nil)
|
||||
k8sClient.EXPECT().CheckCRD("mappings.getambassador.io").MinTimes(1).MaxTimes(1).Return(&apixv1beta1.CustomResourceDefinition{}, nil)
|
||||
|
||||
group := "getambassador.io"
|
||||
version := "v2"
|
||||
@ -87,7 +87,7 @@ func TestHttp_Adapt(t *testing.T) {
|
||||
},
|
||||
}
|
||||
SetReturnResourceVersion(k8sClient, group, version, kind, namespace, EndsessionName, "")
|
||||
k8sClient.EXPECT().ApplyNamespacedCRDResource(group, version, kind, namespace, EndsessionName, endsession).Times(1)
|
||||
k8sClient.EXPECT().ApplyNamespacedCRDResource(group, version, kind, namespace, EndsessionName, endsession).MinTimes(1).MaxTimes(1)
|
||||
|
||||
issuerName := labels.MustForName(componentLabels, IssuerName)
|
||||
issuer := &unstructured.Unstructured{
|
||||
@ -111,7 +111,7 @@ func TestHttp_Adapt(t *testing.T) {
|
||||
},
|
||||
}
|
||||
SetReturnResourceVersion(k8sClient, group, version, kind, namespace, IssuerName, "")
|
||||
k8sClient.EXPECT().ApplyNamespacedCRDResource(group, version, kind, namespace, IssuerName, issuer).Times(1)
|
||||
k8sClient.EXPECT().ApplyNamespacedCRDResource(group, version, kind, namespace, IssuerName, issuer).MinTimes(1).MaxTimes(1)
|
||||
|
||||
authorizeName := labels.MustForName(componentLabels, AuthorizeName)
|
||||
authorize := &unstructured.Unstructured{
|
||||
@ -135,7 +135,7 @@ func TestHttp_Adapt(t *testing.T) {
|
||||
},
|
||||
}
|
||||
SetReturnResourceVersion(k8sClient, group, version, kind, namespace, AuthorizeName, "")
|
||||
k8sClient.EXPECT().ApplyNamespacedCRDResource(group, version, kind, namespace, AuthorizeName, authorize).Times(1)
|
||||
k8sClient.EXPECT().ApplyNamespacedCRDResource(group, version, kind, namespace, AuthorizeName, authorize).MinTimes(1).MaxTimes(1)
|
||||
|
||||
oauthName := labels.MustForName(componentLabels, OauthName)
|
||||
oauth := &unstructured.Unstructured{
|
||||
@ -159,7 +159,7 @@ func TestHttp_Adapt(t *testing.T) {
|
||||
},
|
||||
}
|
||||
SetReturnResourceVersion(k8sClient, group, version, kind, namespace, OauthName, "")
|
||||
k8sClient.EXPECT().ApplyNamespacedCRDResource(group, version, kind, namespace, OauthName, oauth).Times(1)
|
||||
k8sClient.EXPECT().ApplyNamespacedCRDResource(group, version, kind, namespace, OauthName, oauth).MinTimes(1).MaxTimes(1)
|
||||
|
||||
mgmtName := labels.MustForName(componentLabels, MgmtName)
|
||||
mgmt := &unstructured.Unstructured{
|
||||
@ -183,7 +183,7 @@ func TestHttp_Adapt(t *testing.T) {
|
||||
},
|
||||
}
|
||||
SetReturnResourceVersion(k8sClient, group, version, kind, namespace, MgmtName, "")
|
||||
k8sClient.EXPECT().ApplyNamespacedCRDResource(group, version, kind, namespace, MgmtName, mgmt).Times(1)
|
||||
k8sClient.EXPECT().ApplyNamespacedCRDResource(group, version, kind, namespace, MgmtName, mgmt).MinTimes(1).MaxTimes(1)
|
||||
|
||||
adminRName := labels.MustForName(componentLabels, AdminRName)
|
||||
adminR := &unstructured.Unstructured{
|
||||
@ -207,7 +207,7 @@ func TestHttp_Adapt(t *testing.T) {
|
||||
},
|
||||
}
|
||||
SetReturnResourceVersion(k8sClient, group, version, kind, namespace, AdminRName, "")
|
||||
k8sClient.EXPECT().ApplyNamespacedCRDResource(group, version, kind, namespace, AdminRName, adminR).Times(1)
|
||||
k8sClient.EXPECT().ApplyNamespacedCRDResource(group, version, kind, namespace, AdminRName, adminR).MinTimes(1).MaxTimes(1)
|
||||
|
||||
authRName := labels.MustForName(componentLabels, AuthRName)
|
||||
authR := &unstructured.Unstructured{
|
||||
@ -231,7 +231,7 @@ func TestHttp_Adapt(t *testing.T) {
|
||||
},
|
||||
}
|
||||
SetReturnResourceVersion(k8sClient, group, version, kind, namespace, AuthRName, "")
|
||||
k8sClient.EXPECT().ApplyNamespacedCRDResource(group, version, kind, namespace, AuthRName, authR).Times(1)
|
||||
k8sClient.EXPECT().ApplyNamespacedCRDResource(group, version, kind, namespace, AuthRName, authR).MinTimes(1).MaxTimes(1)
|
||||
|
||||
query, _, err := AdaptFunc(monitor, componentLabels, namespace, url, dns)
|
||||
assert.NoError(t, err)
|
||||
@ -257,7 +257,7 @@ func TestHttp_Adapt2(t *testing.T) {
|
||||
}
|
||||
k8sClient := kubernetesmock.NewMockClientInt(gomock.NewController(t))
|
||||
|
||||
k8sClient.EXPECT().CheckCRD("mappings.getambassador.io").Times(1).Return(&apixv1beta1.CustomResourceDefinition{}, nil)
|
||||
k8sClient.EXPECT().CheckCRD("mappings.getambassador.io").MinTimes(1).MaxTimes(1).Return(&apixv1beta1.CustomResourceDefinition{}, nil)
|
||||
|
||||
group := "getambassador.io"
|
||||
version := "v2"
|
||||
@ -296,7 +296,7 @@ func TestHttp_Adapt2(t *testing.T) {
|
||||
},
|
||||
}
|
||||
SetReturnResourceVersion(k8sClient, group, version, kind, namespace, EndsessionName, "")
|
||||
k8sClient.EXPECT().ApplyNamespacedCRDResource(group, version, kind, namespace, EndsessionName, endsession).Times(1)
|
||||
k8sClient.EXPECT().ApplyNamespacedCRDResource(group, version, kind, namespace, EndsessionName, endsession).MinTimes(1).MaxTimes(1)
|
||||
|
||||
issuerName := labels.MustForName(componentLabels, IssuerName)
|
||||
issuer := &unstructured.Unstructured{
|
||||
@ -320,7 +320,7 @@ func TestHttp_Adapt2(t *testing.T) {
|
||||
},
|
||||
}
|
||||
SetReturnResourceVersion(k8sClient, group, version, kind, namespace, IssuerName, "")
|
||||
k8sClient.EXPECT().ApplyNamespacedCRDResource(group, version, kind, namespace, IssuerName, issuer).Times(1)
|
||||
k8sClient.EXPECT().ApplyNamespacedCRDResource(group, version, kind, namespace, IssuerName, issuer).MinTimes(1).MaxTimes(1)
|
||||
|
||||
authorizeName := labels.MustForName(componentLabels, AuthorizeName)
|
||||
authorize := &unstructured.Unstructured{
|
||||
@ -344,7 +344,7 @@ func TestHttp_Adapt2(t *testing.T) {
|
||||
},
|
||||
}
|
||||
SetReturnResourceVersion(k8sClient, group, version, kind, namespace, AuthorizeName, "")
|
||||
k8sClient.EXPECT().ApplyNamespacedCRDResource(group, version, kind, namespace, AuthorizeName, authorize).Times(1)
|
||||
k8sClient.EXPECT().ApplyNamespacedCRDResource(group, version, kind, namespace, AuthorizeName, authorize).MinTimes(1).MaxTimes(1)
|
||||
|
||||
oauthName := labels.MustForName(componentLabels, OauthName)
|
||||
oauth := &unstructured.Unstructured{
|
||||
@ -368,7 +368,7 @@ func TestHttp_Adapt2(t *testing.T) {
|
||||
},
|
||||
}
|
||||
SetReturnResourceVersion(k8sClient, group, version, kind, namespace, OauthName, "")
|
||||
k8sClient.EXPECT().ApplyNamespacedCRDResource(group, version, kind, namespace, OauthName, oauth).Times(1)
|
||||
k8sClient.EXPECT().ApplyNamespacedCRDResource(group, version, kind, namespace, OauthName, oauth).MinTimes(1).MaxTimes(1)
|
||||
|
||||
mgmtName := labels.MustForName(componentLabels, MgmtName)
|
||||
mgmt := &unstructured.Unstructured{
|
||||
@ -392,7 +392,7 @@ func TestHttp_Adapt2(t *testing.T) {
|
||||
},
|
||||
}
|
||||
SetReturnResourceVersion(k8sClient, group, version, kind, namespace, MgmtName, "")
|
||||
k8sClient.EXPECT().ApplyNamespacedCRDResource(group, version, kind, namespace, MgmtName, mgmt).Times(1)
|
||||
k8sClient.EXPECT().ApplyNamespacedCRDResource(group, version, kind, namespace, MgmtName, mgmt).MinTimes(1).MaxTimes(1)
|
||||
|
||||
adminRName := labels.MustForName(componentLabels, AdminRName)
|
||||
adminR := &unstructured.Unstructured{
|
||||
@ -416,7 +416,7 @@ func TestHttp_Adapt2(t *testing.T) {
|
||||
},
|
||||
}
|
||||
SetReturnResourceVersion(k8sClient, group, version, kind, namespace, AdminRName, "")
|
||||
k8sClient.EXPECT().ApplyNamespacedCRDResource(group, version, kind, namespace, AdminRName, adminR).Times(1)
|
||||
k8sClient.EXPECT().ApplyNamespacedCRDResource(group, version, kind, namespace, AdminRName, adminR).MinTimes(1).MaxTimes(1)
|
||||
|
||||
authRName := labels.MustForName(componentLabels, AuthRName)
|
||||
authR := &unstructured.Unstructured{
|
||||
@ -440,7 +440,7 @@ func TestHttp_Adapt2(t *testing.T) {
|
||||
},
|
||||
}
|
||||
SetReturnResourceVersion(k8sClient, group, version, kind, namespace, AuthRName, "")
|
||||
k8sClient.EXPECT().ApplyNamespacedCRDResource(group, version, kind, namespace, AuthRName, authR).Times(1)
|
||||
k8sClient.EXPECT().ApplyNamespacedCRDResource(group, version, kind, namespace, AuthRName, authR).MinTimes(1).MaxTimes(1)
|
||||
|
||||
query, _, err := AdaptFunc(monitor, componentLabels, namespace, url, dns)
|
||||
assert.NoError(t, err)
|
||||
|
@ -30,11 +30,11 @@ func SetReturnResourceVersion(
|
||||
},
|
||||
},
|
||||
}
|
||||
k8sClient.EXPECT().GetNamespacedCRDResource(group, version, kind, namespace, name).Return(ret, nil)
|
||||
k8sClient.EXPECT().GetNamespacedCRDResource(group, version, kind, namespace, name).MinTimes(1).MaxTimes(1).Return(ret, nil)
|
||||
}
|
||||
|
||||
func SetCheckCRD(k8sClient *kubernetesmock.MockClientInt) {
|
||||
k8sClient.EXPECT().CheckCRD("mappings.getambassador.io").Times(1).Return(&apixv1beta1.CustomResourceDefinition{}, nil)
|
||||
k8sClient.EXPECT().CheckCRD("mappings.getambassador.io").MinTimes(1).MaxTimes(1).Return(&apixv1beta1.CustomResourceDefinition{}, nil)
|
||||
}
|
||||
|
||||
func SetMappingsEmpty(
|
||||
@ -68,7 +68,7 @@ func SetMappingsEmpty(
|
||||
},
|
||||
}
|
||||
SetReturnResourceVersion(k8sClient, group, version, kind, namespace, accountsLabels.Name(), "")
|
||||
k8sClient.EXPECT().ApplyNamespacedCRDResource(group, version, kind, namespace, accountsLabels.Name(), accounts).Times(1)
|
||||
k8sClient.EXPECT().ApplyNamespacedCRDResource(group, version, kind, namespace, accountsLabels.Name(), accounts).MinTimes(1).MaxTimes(1)
|
||||
|
||||
console := &unstructured.Unstructured{
|
||||
Object: map[string]interface{}{
|
||||
@ -88,7 +88,7 @@ func SetMappingsEmpty(
|
||||
},
|
||||
}
|
||||
SetReturnResourceVersion(k8sClient, group, version, kind, namespace, consoleLabels.Name(), "")
|
||||
k8sClient.EXPECT().ApplyNamespacedCRDResource(group, version, kind, namespace, consoleLabels.Name(), console).Times(1)
|
||||
k8sClient.EXPECT().ApplyNamespacedCRDResource(group, version, kind, namespace, consoleLabels.Name(), console).MinTimes(1).MaxTimes(1)
|
||||
}
|
||||
|
||||
func TestUi_Adapt(t *testing.T) {
|
||||
@ -171,7 +171,7 @@ func TestUi_Adapt2(t *testing.T) {
|
||||
},
|
||||
}
|
||||
SetReturnResourceVersion(k8sClient, group, version, kind, namespace, AccountsName, "")
|
||||
k8sClient.EXPECT().ApplyNamespacedCRDResource(group, version, kind, namespace, AccountsName, accounts).Times(1)
|
||||
k8sClient.EXPECT().ApplyNamespacedCRDResource(group, version, kind, namespace, AccountsName, accounts).MinTimes(1).MaxTimes(1)
|
||||
|
||||
consoleName := labels.MustForName(componentLabels, ConsoleName)
|
||||
console := &unstructured.Unstructured{
|
||||
@ -192,7 +192,7 @@ func TestUi_Adapt2(t *testing.T) {
|
||||
},
|
||||
}
|
||||
SetReturnResourceVersion(k8sClient, group, version, kind, namespace, ConsoleName, "")
|
||||
k8sClient.EXPECT().ApplyNamespacedCRDResource(group, version, kind, namespace, ConsoleName, console).Times(1)
|
||||
k8sClient.EXPECT().ApplyNamespacedCRDResource(group, version, kind, namespace, ConsoleName, console).MinTimes(1).MaxTimes(1)
|
||||
|
||||
query, _, err := AdaptFunc(monitor, componentLabels, namespace, uiURL, dns)
|
||||
assert.NoError(t, err)
|
||||
|
@ -19,11 +19,11 @@ func TestConfiguration_Ready1(t *testing.T) {
|
||||
cmName := "testCM"
|
||||
consoleCMName := "testConsole"
|
||||
|
||||
client.EXPECT().WaitForConfigMap(namespace, cmName, timeout).Times(1).Return(nil)
|
||||
client.EXPECT().WaitForConfigMap(namespace, consoleCMName, timeout).Times(1).Return(nil)
|
||||
client.EXPECT().WaitForSecret(namespace, secretName, timeout).Times(1).Return(nil)
|
||||
client.EXPECT().WaitForSecret(namespace, secretVarsName, timeout).Times(1).Return(nil)
|
||||
client.EXPECT().WaitForSecret(namespace, secretPasswordName, timeout).Times(1).Return(nil)
|
||||
client.EXPECT().WaitForConfigMap(namespace, cmName, timeout).MinTimes(1).MaxTimes(1).Return(nil)
|
||||
client.EXPECT().WaitForConfigMap(namespace, consoleCMName, timeout).MinTimes(1).MaxTimes(1).Return(nil)
|
||||
client.EXPECT().WaitForSecret(namespace, secretName, timeout).MinTimes(1).MaxTimes(1).Return(nil)
|
||||
client.EXPECT().WaitForSecret(namespace, secretVarsName, timeout).MinTimes(1).MaxTimes(1).Return(nil)
|
||||
client.EXPECT().WaitForSecret(namespace, secretPasswordName, timeout).MinTimes(1).MaxTimes(1).Return(nil)
|
||||
|
||||
readyFunc := GetReadyFunc(monitor, namespace, secretName, secretVarsName, secretPasswordName, cmName, consoleCMName)
|
||||
assert.NotNil(t, readyFunc)
|
||||
@ -40,11 +40,11 @@ func TestConfiguration_Ready2(t *testing.T) {
|
||||
cmName := "testCM2"
|
||||
consoleCMName := "testConsole2"
|
||||
|
||||
client.EXPECT().WaitForConfigMap(namespace, cmName, timeout).Times(1).Return(nil)
|
||||
client.EXPECT().WaitForConfigMap(namespace, consoleCMName, timeout).Times(1).Return(nil)
|
||||
client.EXPECT().WaitForSecret(namespace, secretName, timeout).Times(1).Return(nil)
|
||||
client.EXPECT().WaitForSecret(namespace, secretVarsName, timeout).Times(1).Return(nil)
|
||||
client.EXPECT().WaitForSecret(namespace, secretPasswordName, timeout).Times(1).Return(nil)
|
||||
client.EXPECT().WaitForConfigMap(namespace, cmName, timeout).MinTimes(1).MaxTimes(1).Return(nil)
|
||||
client.EXPECT().WaitForConfigMap(namespace, consoleCMName, timeout).MinTimes(1).MaxTimes(1).Return(nil)
|
||||
client.EXPECT().WaitForSecret(namespace, secretName, timeout).MinTimes(1).MaxTimes(1).Return(nil)
|
||||
client.EXPECT().WaitForSecret(namespace, secretVarsName, timeout).MinTimes(1).MaxTimes(1).Return(nil)
|
||||
client.EXPECT().WaitForSecret(namespace, secretPasswordName, timeout).MinTimes(1).MaxTimes(1).Return(nil)
|
||||
|
||||
readyFunc := GetReadyFunc(monitor, namespace, secretName, secretVarsName, secretPasswordName, cmName, consoleCMName)
|
||||
assert.NotNil(t, readyFunc)
|
||||
@ -61,11 +61,11 @@ func TestConfiguration_ReadyFail1(t *testing.T) {
|
||||
cmName := "testCM"
|
||||
consoleCMName := "testConsole"
|
||||
|
||||
client.EXPECT().WaitForConfigMap(namespace, cmName, timeout).Times(1).Return(errors.New("fail"))
|
||||
client.EXPECT().WaitForConfigMap(namespace, consoleCMName, timeout).Times(1).Return(nil)
|
||||
client.EXPECT().WaitForSecret(namespace, secretName, timeout).Times(1).Return(nil)
|
||||
client.EXPECT().WaitForSecret(namespace, secretVarsName, timeout).Times(1).Return(nil)
|
||||
client.EXPECT().WaitForSecret(namespace, secretPasswordName, timeout).Times(1).Return(nil)
|
||||
client.EXPECT().WaitForConfigMap(namespace, cmName, timeout).MinTimes(1).MaxTimes(1).Return(errors.New("fail"))
|
||||
client.EXPECT().WaitForConfigMap(namespace, consoleCMName, timeout).MinTimes(1).MaxTimes(1).Return(nil)
|
||||
client.EXPECT().WaitForSecret(namespace, secretName, timeout).MinTimes(1).MaxTimes(1).Return(nil)
|
||||
client.EXPECT().WaitForSecret(namespace, secretVarsName, timeout).MinTimes(1).MaxTimes(1).Return(nil)
|
||||
client.EXPECT().WaitForSecret(namespace, secretPasswordName, timeout).MinTimes(1).MaxTimes(1).Return(nil)
|
||||
|
||||
readyFunc := GetReadyFunc(monitor, namespace, secretName, secretVarsName, secretPasswordName, cmName, consoleCMName)
|
||||
assert.NotNil(t, readyFunc)
|
||||
@ -82,11 +82,11 @@ func TestConfiguration_ReadyFail2(t *testing.T) {
|
||||
cmName := "testCM"
|
||||
consoleCMName := "testConsole"
|
||||
|
||||
client.EXPECT().WaitForConfigMap(namespace, cmName, timeout).Times(1).Return(nil)
|
||||
client.EXPECT().WaitForConfigMap(namespace, consoleCMName, timeout).Times(1).Return(errors.New("fail"))
|
||||
client.EXPECT().WaitForSecret(namespace, secretName, timeout).Times(1).Return(nil)
|
||||
client.EXPECT().WaitForSecret(namespace, secretVarsName, timeout).Times(1).Return(nil)
|
||||
client.EXPECT().WaitForSecret(namespace, secretPasswordName, timeout).Times(1).Return(nil)
|
||||
client.EXPECT().WaitForConfigMap(namespace, cmName, timeout).MinTimes(1).MaxTimes(1).Return(nil)
|
||||
client.EXPECT().WaitForConfigMap(namespace, consoleCMName, timeout).MinTimes(1).MaxTimes(1).Return(errors.New("fail"))
|
||||
client.EXPECT().WaitForSecret(namespace, secretName, timeout).MinTimes(1).MaxTimes(1).Return(nil)
|
||||
client.EXPECT().WaitForSecret(namespace, secretVarsName, timeout).MinTimes(1).MaxTimes(1).Return(nil)
|
||||
client.EXPECT().WaitForSecret(namespace, secretPasswordName, timeout).MinTimes(1).MaxTimes(1).Return(nil)
|
||||
|
||||
readyFunc := GetReadyFunc(monitor, namespace, secretName, secretVarsName, secretPasswordName, cmName, consoleCMName)
|
||||
assert.NotNil(t, readyFunc)
|
||||
@ -103,11 +103,11 @@ func TestConfiguration_ReadyFail3(t *testing.T) {
|
||||
cmName := "testCM"
|
||||
consoleCMName := "testConsole"
|
||||
|
||||
client.EXPECT().WaitForConfigMap(namespace, cmName, timeout).Times(1).Return(nil)
|
||||
client.EXPECT().WaitForConfigMap(namespace, consoleCMName, timeout).Times(1).Return(nil)
|
||||
client.EXPECT().WaitForSecret(namespace, secretName, timeout).Times(1).Return(errors.New("fail"))
|
||||
client.EXPECT().WaitForSecret(namespace, secretVarsName, timeout).Times(1).Return(nil)
|
||||
client.EXPECT().WaitForSecret(namespace, secretPasswordName, timeout).Times(1).Return(nil)
|
||||
client.EXPECT().WaitForConfigMap(namespace, cmName, timeout).MinTimes(1).MaxTimes(1).Return(nil)
|
||||
client.EXPECT().WaitForConfigMap(namespace, consoleCMName, timeout).MinTimes(1).MaxTimes(1).Return(nil)
|
||||
client.EXPECT().WaitForSecret(namespace, secretName, timeout).MinTimes(1).MaxTimes(1).Return(errors.New("fail"))
|
||||
client.EXPECT().WaitForSecret(namespace, secretVarsName, timeout).MinTimes(1).MaxTimes(1).Return(nil)
|
||||
client.EXPECT().WaitForSecret(namespace, secretPasswordName, timeout).MinTimes(1).MaxTimes(1).Return(nil)
|
||||
|
||||
readyFunc := GetReadyFunc(monitor, namespace, secretName, secretVarsName, secretPasswordName, cmName, consoleCMName)
|
||||
assert.NotNil(t, readyFunc)
|
||||
@ -124,11 +124,11 @@ func TestConfiguration_ReadyFail4(t *testing.T) {
|
||||
cmName := "testCM"
|
||||
consoleCMName := "testConsole"
|
||||
|
||||
client.EXPECT().WaitForConfigMap(namespace, cmName, timeout).Times(1).Return(nil)
|
||||
client.EXPECT().WaitForConfigMap(namespace, consoleCMName, timeout).Times(1).Return(nil)
|
||||
client.EXPECT().WaitForSecret(namespace, secretName, timeout).Times(1).Return(nil)
|
||||
client.EXPECT().WaitForSecret(namespace, secretVarsName, timeout).Times(1).Return(errors.New("fail"))
|
||||
client.EXPECT().WaitForSecret(namespace, secretPasswordName, timeout).Times(1).Return(nil)
|
||||
client.EXPECT().WaitForConfigMap(namespace, cmName, timeout).MinTimes(1).MaxTimes(1).Return(nil)
|
||||
client.EXPECT().WaitForConfigMap(namespace, consoleCMName, timeout).MinTimes(1).MaxTimes(1).Return(nil)
|
||||
client.EXPECT().WaitForSecret(namespace, secretName, timeout).MinTimes(1).MaxTimes(1).Return(nil)
|
||||
client.EXPECT().WaitForSecret(namespace, secretVarsName, timeout).MinTimes(1).MaxTimes(1).Return(errors.New("fail"))
|
||||
client.EXPECT().WaitForSecret(namespace, secretPasswordName, timeout).MinTimes(1).MaxTimes(1).Return(nil)
|
||||
|
||||
readyFunc := GetReadyFunc(monitor, namespace, secretName, secretVarsName, secretPasswordName, cmName, consoleCMName)
|
||||
assert.NotNil(t, readyFunc)
|
||||
@ -145,11 +145,11 @@ func TestConfiguration_ReadyFail5(t *testing.T) {
|
||||
cmName := "testCM"
|
||||
consoleCMName := "testConsole"
|
||||
|
||||
client.EXPECT().WaitForConfigMap(namespace, cmName, timeout).Times(1).Return(nil)
|
||||
client.EXPECT().WaitForConfigMap(namespace, consoleCMName, timeout).Times(1).Return(nil)
|
||||
client.EXPECT().WaitForSecret(namespace, secretName, timeout).Times(1).Return(nil)
|
||||
client.EXPECT().WaitForSecret(namespace, secretVarsName, timeout).Times(1).Return(nil)
|
||||
client.EXPECT().WaitForSecret(namespace, secretPasswordName, timeout).Times(1).Return(errors.New("fail"))
|
||||
client.EXPECT().WaitForConfigMap(namespace, cmName, timeout).MinTimes(1).MaxTimes(1).Return(nil)
|
||||
client.EXPECT().WaitForConfigMap(namespace, consoleCMName, timeout).MinTimes(1).MaxTimes(1).Return(nil)
|
||||
client.EXPECT().WaitForSecret(namespace, secretName, timeout).MinTimes(1).MaxTimes(1).Return(nil)
|
||||
client.EXPECT().WaitForSecret(namespace, secretVarsName, timeout).MinTimes(1).MaxTimes(1).Return(nil)
|
||||
client.EXPECT().WaitForSecret(namespace, secretPasswordName, timeout).MinTimes(1).MaxTimes(1).Return(errors.New("fail"))
|
||||
|
||||
readyFunc := GetReadyFunc(monitor, namespace, secretName, secretVarsName, secretPasswordName, cmName, consoleCMName)
|
||||
assert.NotNil(t, readyFunc)
|
||||
|
@ -77,8 +77,8 @@ func TestDatabase_AdaptFailConnection(t *testing.T) {
|
||||
monitor := mntr.Monitor{}
|
||||
queried := map[string]interface{}{}
|
||||
|
||||
dbClient.EXPECT().GetConnectionInfo(monitor, k8sClient).Return("", "", errors.New("fail"))
|
||||
dbClient.EXPECT().ListUsers(monitor, k8sClient).Return([]string{"test"}, nil)
|
||||
dbClient.EXPECT().GetConnectionInfo(monitor, k8sClient).MinTimes(1).MaxTimes(1).Return("", "", errors.New("fail"))
|
||||
dbClient.EXPECT().ListUsers(monitor, k8sClient).MinTimes(1).MaxTimes(1).Return([]string{"test"}, nil)
|
||||
|
||||
_, err := GetDatabaseInQueried(queried)
|
||||
assert.Error(t, err)
|
||||
|
@ -2853,6 +2853,7 @@ message ApplicationView {
|
||||
string name = 5;
|
||||
oneof app_config {
|
||||
OIDCConfig oidc_config = 8;
|
||||
APIConfig api_config = 10;
|
||||
}
|
||||
|
||||
uint64 sequence = 9;
|
||||
|
Loading…
x
Reference in New Issue
Block a user