Skip to content

Commit

Permalink
Merge pull request #309 from p0lyn0mial/enable-encryption-tests
Browse files Browse the repository at this point in the history
enables the encryption tests
  • Loading branch information
openshift-merge-robot committed Jul 30, 2020
2 parents 0708acb + 78c9b34 commit e2f7c26
Showing 1 changed file with 9 additions and 17 deletions.
26 changes: 9 additions & 17 deletions test/e2e-encryption/encryption_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@ var DefaultTargetGRs = []schema.GroupResource{
}

func TestEncryptionTypeIdentity(t *testing.T) {
// TODO: bring back when https://github.com/openshift/cluster-openshift-apiserver-operator/pull/348 is merged
t.Skip()
library.TestEncryptionTypeIdentity(t, library.BasicScenario{
Namespace: "openshift-config-managed",
// TODO: update the LabelSelector in 4.7, in 4.6 OAS-O is managing the encryption configuration for CAO
Expand All @@ -36,13 +34,11 @@ func TestEncryptionTypeIdentity(t *testing.T) {
EncryptionConfigSecretNamespace: "openshift-config-managed",
OperatorNamespace: "openshift-authentication-operator",
TargetGRs: DefaultTargetGRs,
AssertFunc: AssertTokens,
AssertFunc: assertTokens,
})
}

func TestEncryptionTypeUnset(t *testing.T) {
// TODO: bring back when https://github.com/openshift/cluster-openshift-apiserver-operator/pull/348 is merged
t.Skip()
library.TestEncryptionTypeUnset(t, library.BasicScenario{
Namespace: "openshift-config-managed",
// TODO: update the LabelSelector in 4.7, in 4.6 OAS-O is managing the encryption configuration for CAO
Expand All @@ -52,13 +48,11 @@ func TestEncryptionTypeUnset(t *testing.T) {
EncryptionConfigSecretNamespace: "openshift-config-managed",
OperatorNamespace: "openshift-authentication-operator",
TargetGRs: DefaultTargetGRs,
AssertFunc: AssertTokens,
AssertFunc: assertTokens,
})
}

func TestEncryptionTurnOnAndOff(t *testing.T) {
// TODO: bring back when https://github.com/openshift/cluster-openshift-apiserver-operator/pull/348 is merged
t.Skip()
library.TestEncryptionTurnOnAndOff(t, library.OnOffScenario{
BasicScenario: library.BasicScenario{
Namespace: "openshift-config-managed",
Expand All @@ -69,13 +63,13 @@ func TestEncryptionTurnOnAndOff(t *testing.T) {
EncryptionConfigSecretNamespace: "openshift-config-managed",
OperatorNamespace: "openshift-authentication-operator",
TargetGRs: DefaultTargetGRs,
AssertFunc: AssertTokens,
AssertFunc: assertTokens,
},
CreateResourceFunc: func(t testing.TB, _ library.ClientSet, namespace string) runtime.Object {
return CreateAndStoreTokenOfLife(context.TODO(), t, GetClients(t))
},
AssertResourceEncryptedFunc: AssertTokenOfLifeEncrypted,
AssertResourceNotEncryptedFunc: AssertTokenOfLifeNotEncrypted,
AssertResourceEncryptedFunc: assertTokenOfLifeEncrypted,
AssertResourceNotEncryptedFunc: assertTokenOfLifeNotEncrypted,
ResourceFunc: func(t testing.TB, _ string) runtime.Object { return TokenOfLife(t) },
ResourceName: "TokenOfLife",
})
Expand All @@ -84,8 +78,6 @@ func TestEncryptionTurnOnAndOff(t *testing.T) {
// TestEncryptionRotation first encrypts data with aescbc key
// then it forces a key rotation by setting the "encyrption.Reason" in the operator's configuration file
func TestEncryptionRotation(t *testing.T) {
// TODO: bring back when https://github.com/openshift/cluster-openshift-apiserver-operator/pull/348 is merged
t.Skip()
ctx := context.TODO()
library.TestEncryptionRotation(t, library.RotationScenario{
BasicScenario: library.BasicScenario{
Expand All @@ -97,7 +89,7 @@ func TestEncryptionRotation(t *testing.T) {
EncryptionConfigSecretNamespace: "openshift-config-managed",
OperatorNamespace: "openshift-authentication-operator",
TargetGRs: DefaultTargetGRs,
AssertFunc: AssertTokens,
AssertFunc: assertTokens,
},
CreateResourceFunc: func(t testing.TB, _ library.ClientSet, _ string) runtime.Object {
return CreateAndStoreTokenOfLife(ctx, t, GetClients(t))
Expand All @@ -118,7 +110,7 @@ func TestEncryptionRotation(t *testing.T) {
})
}

func AssertTokens(t testing.TB, clientSet library.ClientSet, expectedMode configv1.EncryptionType, namespace, labelSelector string) {
func assertTokens(t testing.TB, clientSet library.ClientSet, expectedMode configv1.EncryptionType, namespace, labelSelector string) {
t.Helper()
assertAccessTokens(t, clientSet.Etcd, string(expectedMode))
assertAuthTokens(t, clientSet.Etcd, string(expectedMode))
Expand All @@ -139,7 +131,7 @@ func assertAuthTokens(t testing.TB, etcdClient library.EtcdClient, expectedMode
require.NoError(t, err)
}

func AssertTokenOfLifeEncrypted(t testing.TB, clientSet library.ClientSet, rawTokenOfLife runtime.Object) {
func assertTokenOfLifeEncrypted(t testing.TB, clientSet library.ClientSet, rawTokenOfLife runtime.Object) {
t.Helper()
tokenOfLife := rawTokenOfLife.(*oauthapiv1.OAuthAccessToken)
rawTokenValue := GetRawTokenOfLife(t, clientSet)
Expand All @@ -148,7 +140,7 @@ func AssertTokenOfLifeEncrypted(t testing.TB, clientSet library.ClientSet, rawTo
}
}

func AssertTokenOfLifeNotEncrypted(t testing.TB, clientSet library.ClientSet, rawTokenOfLife runtime.Object) {
func assertTokenOfLifeNotEncrypted(t testing.TB, clientSet library.ClientSet, rawTokenOfLife runtime.Object) {
t.Helper()
tokenOfLife := rawTokenOfLife.(*oauthapiv1.OAuthAccessToken)
rawTokenValue := GetRawTokenOfLife(t, clientSet)
Expand Down

0 comments on commit e2f7c26

Please sign in to comment.