-
Notifications
You must be signed in to change notification settings - Fork 828
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Flaky: Fix test for TestGameServerUnhealthyAfterDeletingPod (#758)
Change in behaviour on Unhealthy GameServers that are not in Fleets (deleted vs just being marked as Unhealthy), caused this e2e test to be flaky. Added a TODO to review if we are still happy with this, since release is coming up, and having stable tests is most important right now.
- Loading branch information
1 parent
93f0c3a
commit 521be13
Showing
2 changed files
with
25 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,6 +21,7 @@ import ( | |
"agones.dev/agones/pkg/apis/stable" | ||
"agones.dev/agones/pkg/apis/stable/v1alpha1" | ||
e2eframework "agones.dev/agones/test/e2e/framework" | ||
"github.com/sirupsen/logrus" | ||
"github.com/stretchr/testify/assert" | ||
corev1 "k8s.io/api/core/v1" | ||
k8serrors "k8s.io/apimachinery/pkg/api/errors" | ||
|
@@ -192,6 +193,8 @@ func TestGameServerUnhealthyAfterDeletingPod(t *testing.T) { | |
t.Fatalf("Could not get a GameServer ready: %v", err) | ||
} | ||
|
||
logrus.WithField("gsKey", readyGs.ObjectMeta.Name).Info("GameServer Ready") | ||
|
||
gsClient := framework.AgonesClient.StableV1alpha1().GameServers(defaultNs) | ||
podClient := framework.KubeClient.CoreV1().Pods(defaultNs) | ||
|
||
|
@@ -205,7 +208,27 @@ func TestGameServerUnhealthyAfterDeletingPod(t *testing.T) { | |
err = podClient.Delete(pod.ObjectMeta.Name, nil) | ||
assert.NoError(t, err) | ||
|
||
_, err = framework.WaitForGameServerState(readyGs, v1alpha1.GameServerStateUnhealthy, 10*time.Second) | ||
// TODO [[email protected]]: Should GameServers that are Unhealthy and not in a fleet be deleted? | ||
err = wait.PollImmediate(2*time.Second, time.Minute, func() (bool, error) { | ||
gs, err := framework.AgonesClient.StableV1alpha1().GameServers(readyGs.Namespace).Get(readyGs.ObjectMeta.Name, metav1.GetOptions{}) | ||
|
||
// just in case | ||
if k8serrors.IsNotFound(err) { | ||
return true, nil | ||
} | ||
|
||
if err != nil { | ||
logrus.WithError(err).Warn("error retrieving gameserver") | ||
return false, nil | ||
} | ||
|
||
if gs.Status.State == v1alpha1.GameServerStateUnhealthy { | ||
return true, nil | ||
} | ||
|
||
return false, nil | ||
}) | ||
|
||
assert.NoError(t, err) | ||
} | ||
|
||
|