-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
374 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
package functional_test | ||
|
||
import ( | ||
//"fmt" | ||
"os" | ||
|
||
. "github.com/onsi/ginkgo/v2" | ||
. "github.com/onsi/gomega" | ||
//. "github.com/openstack-k8s-operators/lib-common/modules/common/test/helpers" | ||
//corev1 "k8s.io/api/core/v1" | ||
"k8s.io/apimachinery/pkg/types" | ||
//"k8s.io/utils/ptr" | ||
//memcachedv1 "github.com/openstack-k8s-operators/infra-operator/apis/memcached/v1beta1" | ||
//condition "github.com/openstack-k8s-operators/lib-common/modules/common/condition" | ||
) | ||
|
||
var _ = Describe("Barbican controller", func() { | ||
|
||
var barbicanName types.NamespacedName | ||
//var dbSyncJobName types.NamespacedName | ||
//var bootstrapJobName types.NamespacedName | ||
//var deploymentName types.NamespacedName | ||
|
||
BeforeEach(func() { | ||
|
||
barbicanName = types.NamespacedName{ | ||
Name: "barbican", | ||
Namespace: namespace, | ||
} | ||
/* | ||
dbSyncJobName = types.NamespacedName{ | ||
Name: "keystone-db-sync", | ||
Namespace: namespace, | ||
} | ||
bootstrapJobName = types.NamespacedName{ | ||
Name: "keystone-bootstrap", | ||
Namespace: namespace, | ||
} | ||
deploymentName = types.NamespacedName{ | ||
Name: "keystone", | ||
Namespace: namespace, | ||
} | ||
*/ | ||
|
||
err := os.Setenv("OPERATOR_TEMPLATES", "../../templates") | ||
Expect(err).NotTo(HaveOccurred()) | ||
}) | ||
|
||
When("A Barbican instance is created", func() { | ||
BeforeEach(func() { | ||
DeferCleanup(th.DeleteInstance, CreateBarbican(barbicanName, GetDefaultBarbicanSpec())) | ||
}) | ||
|
||
It("should have the Spec fields defaulted", func() { | ||
Barbican := GetBarbican(barbicanName) | ||
Expect(Barbican.Spec.ServiceUser).Should(Equal("barbican")) | ||
Expect(Barbican.Spec.DatabaseInstance).Should(Equal("openstack")) | ||
Expect(Barbican.Spec.DatabaseUser).Should(Equal("barbican")) | ||
}) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
/* | ||
Copyright 2023. | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
package functional_test | ||
|
||
import ( | ||
. "github.com/onsi/gomega" | ||
|
||
//batchv1 "k8s.io/api/batch/v1" | ||
//corev1 "k8s.io/api/core/v1" | ||
"k8s.io/apimachinery/pkg/types" | ||
"sigs.k8s.io/controller-runtime/pkg/client" | ||
|
||
barbicanv1 "github.com/openstack-k8s-operators/barbican-operator/api/v1beta1" | ||
//condition "github.com/openstack-k8s-operators/lib-common/modules/common/condition" | ||
) | ||
|
||
func GetDefaultBarbicanSpec() map[string]interface{} { | ||
return map[string]interface{}{ | ||
"databaseInstance": "openstack", | ||
//"replicas": 1, | ||
"secret": SecretName, | ||
} | ||
} | ||
|
||
func CreateBarbican(name types.NamespacedName, spec map[string]interface{}) client.Object { | ||
|
||
raw := map[string]interface{}{ | ||
"apiVersion": "barbican.openstack.org/v1beta1", | ||
"kind": "Barbican", | ||
"metadata": map[string]interface{}{ | ||
"name": name.Name, | ||
"namespace": name.Namespace, | ||
}, | ||
"spec": spec, | ||
} | ||
return th.CreateUnstructured(raw) | ||
} | ||
|
||
func GetBarbican(name types.NamespacedName) *barbicanv1.Barbican { | ||
instance := &barbicanv1.Barbican{} | ||
Eventually(func(g Gomega) { | ||
g.Expect(k8sClient.Get(ctx, name, instance)).Should(Succeed()) | ||
}, timeout, interval).Should(Succeed()) | ||
return instance | ||
} | ||
|
||
/* | ||
func CreateKeystoneAPISecret(namespace string, name string) *corev1.Secret { | ||
return th.CreateSecret( | ||
types.NamespacedName{Namespace: namespace, Name: name}, | ||
map[string][]byte{ | ||
"AdminPassword": []byte("12345678"), | ||
"KeystoneDatabasePassword": []byte("12345678"), | ||
}, | ||
) | ||
} | ||
func KeystoneConditionGetter(name types.NamespacedName) condition.Conditions { | ||
instance := GetKeystoneAPI(name) | ||
return instance.Status.Conditions | ||
} | ||
func GetCronJob(name types.NamespacedName) *batchv1.CronJob { | ||
instance := &batchv1.CronJob{} | ||
Eventually(func(g Gomega) { | ||
g.Expect(k8sClient.Get(ctx, name, instance)).Should(Succeed()) | ||
}, timeout, interval).Should(Succeed()) | ||
return instance | ||
} | ||
*/ |
Oops, something went wrong.