-
Notifications
You must be signed in to change notification settings - Fork 1
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
1 parent
5a52993
commit 2d6a734
Showing
5 changed files
with
81 additions
and
99 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,68 +1,59 @@ | ||
package controller | ||
|
||
import ( | ||
"context" | ||
|
||
. "github.com/onsi/ginkgo/v2" | ||
. "github.com/onsi/gomega" | ||
"k8s.io/apimachinery/pkg/api/errors" | ||
"k8s.io/apimachinery/pkg/types" | ||
"sigs.k8s.io/controller-runtime/pkg/reconcile" | ||
|
||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
|
||
magoutv1 "github.com/ushitora-anqou/magout/api/v1" | ||
) | ||
|
||
var _ = Describe("MastodonServer Controller", func() { | ||
Context("When reconciling a resource", func() { | ||
const resourceName = "test-resource" | ||
|
||
ctx := context.Background() | ||
|
||
typeNamespacedName := types.NamespacedName{ | ||
Name: resourceName, | ||
Namespace: "default", // TODO(user):Modify as needed | ||
} | ||
mastodonserver := &magoutv1.MastodonServer{} | ||
|
||
BeforeEach(func() { | ||
By("creating the custom resource for the Kind MastodonServer") | ||
err := k8sClient.Get(ctx, typeNamespacedName, mastodonserver) | ||
if err != nil && errors.IsNotFound(err) { | ||
resource := &magoutv1.MastodonServer{ | ||
ObjectMeta: metav1.ObjectMeta{ | ||
Name: resourceName, | ||
Namespace: "default", | ||
}, | ||
// TODO(user): Specify other spec details if needed. | ||
} | ||
Expect(k8sClient.Create(ctx, resource)).To(Succeed()) | ||
} | ||
}) | ||
|
||
AfterEach(func() { | ||
// TODO(user): Cleanup logic after each test, like removing the resource instance. | ||
resource := &magoutv1.MastodonServer{} | ||
err := k8sClient.Get(ctx, typeNamespacedName, resource) | ||
Expect(err).NotTo(HaveOccurred()) | ||
|
||
By("Cleanup the specific resource instance MastodonServer") | ||
Expect(k8sClient.Delete(ctx, resource)).To(Succeed()) | ||
}) | ||
It("should successfully reconcile the resource", func() { | ||
By("Reconciling the created resource") | ||
controllerReconciler := &MastodonServerReconciler{ | ||
Client: k8sClient, | ||
Scheme: k8sClient.Scheme(), | ||
} | ||
|
||
_, err := controllerReconciler.Reconcile(ctx, reconcile.Request{ | ||
NamespacedName: typeNamespacedName, | ||
}) | ||
Expect(err).NotTo(HaveOccurred()) | ||
// TODO(user): Add more specific assertions depending on your controller's reconciliation logic. | ||
// Example: If you expect a certain status condition after reconciliation, verify it here. | ||
}) | ||
}) | ||
}) | ||
// import ( | ||
// . "github.com/onsi/ginkgo/v2" | ||
// . "github.com/onsi/gomega" | ||
// ) | ||
|
||
// var _ = Describe("MastodonServer Controller", func() { | ||
// Context("When reconciling a resource", func() { | ||
// const resourceName = "test-resource" | ||
// | ||
// ctx := context.Background() | ||
// | ||
// typeNamespacedName := types.NamespacedName{ | ||
// Name: resourceName, | ||
// Namespace: "default", // TODO(user):Modify as needed | ||
// } | ||
// mastodonserver := &magoutv1.MastodonServer{} | ||
// | ||
// BeforeEach(func() { | ||
// By("creating the custom resource for the Kind MastodonServer") | ||
// err := k8sClient.Get(ctx, typeNamespacedName, mastodonserver) | ||
// if err != nil && errors.IsNotFound(err) { | ||
// resource := &magoutv1.MastodonServer{ | ||
// ObjectMeta: metav1.ObjectMeta{ | ||
// Name: resourceName, | ||
// Namespace: "default", | ||
// }, | ||
// // TODO(user): Specify other spec details if needed. | ||
// } | ||
// Expect(k8sClient.Create(ctx, resource)).To(Succeed()) | ||
// } | ||
// }) | ||
// | ||
// AfterEach(func() { | ||
// // TODO(user): Cleanup logic after each test, like removing the resource instance. | ||
// resource := &magoutv1.MastodonServer{} | ||
// err := k8sClient.Get(ctx, typeNamespacedName, resource) | ||
// Expect(err).NotTo(HaveOccurred()) | ||
// | ||
// By("Cleanup the specific resource instance MastodonServer") | ||
// Expect(k8sClient.Delete(ctx, resource)).To(Succeed()) | ||
// }) | ||
// It("should successfully reconcile the resource", func() { | ||
// By("Reconciling the created resource") | ||
// controllerReconciler := &MastodonServerReconciler{ | ||
// Client: k8sClient, | ||
// Scheme: k8sClient.Scheme(), | ||
// } | ||
// | ||
// _, err := controllerReconciler.Reconcile(ctx, reconcile.Request{ | ||
// NamespacedName: typeNamespacedName, | ||
// }) | ||
// Expect(err).NotTo(HaveOccurred()) | ||
// // TODO(user): Add more specific assertions depending on your controller's reconciliation logic. | ||
// // Example: If you expect a certain status condition after reconciliation, verify it here. | ||
// }) | ||
// }) | ||
// }) |
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 |
---|---|---|
@@ -1,14 +1,14 @@ | ||
package e2e | ||
|
||
import ( | ||
. "github.com/onsi/ginkgo/v2" | ||
//. "github.com/onsi/gomega" | ||
) | ||
|
||
var _ = Describe("controller", Ordered, func() { | ||
Context("Operator", func() { | ||
It("should run successfully", func() { | ||
return | ||
}) | ||
}) | ||
}) | ||
// import ( | ||
// . "github.com/onsi/ginkgo/v2" | ||
// . "github.com/onsi/gomega" | ||
// ) | ||
// | ||
// var _ = Describe("controller", Ordered, func() { | ||
// Context("Operator", func() { | ||
// It("should run successfully", func() { | ||
// return | ||
// }) | ||
// }) | ||
// }) |