Skip to content

Commit

Permalink
fixing webhook test
Browse files Browse the repository at this point in the history
  • Loading branch information
dgkanatsios committed Jun 14, 2022
1 parent 7c7a0da commit 5a3257a
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions pkg/operator/api/v1alpha1/gameserverbuild_webhook_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,19 @@ package v1alpha1
import (
"math/rand"
"os"
"time"

. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/util/uuid"
"sigs.k8s.io/controller-runtime/pkg/client"
)

const (
timeout = time.Second * 5
interval = time.Millisecond * 250
)

var _ = Describe("GameServerBuild webhook tests", func() {
Expand All @@ -19,6 +26,12 @@ var _ = Describe("GameServerBuild webhook tests", func() {
buildName2, _ := getNewNameAndID()
gsb := createTestGameServerBuild(buildName, buildID, 2, 4, false)
Expect(k8sClient.Create(ctx, &gsb)).Should(Succeed())
// make sure the new GameServerBuild is part of the cache
var gsbTest GameServerBuild
Eventually(func() bool {
err := k8sClient.Get(ctx, client.ObjectKey{Name: buildName, Namespace: "default"}, &gsbTest)
return err == nil
}, timeout, interval).Should(BeTrue())
gsb = createTestGameServerBuild(buildName2, buildID, 2, 4, false)
err := k8sClient.Create(ctx, &gsb)
Expect(err).To(HaveOccurred())
Expand Down

0 comments on commit 5a3257a

Please sign in to comment.