-
Notifications
You must be signed in to change notification settings - Fork 77
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve external E2E test logic (#377)
This change does the following: - Converts individual external E2E tests to subtests. This now matches the standard E2E test flow and provides better test logging output. - Split Mattermost version upgrade test out from base test. - Improve reconciliation logging with more status output. - Improve reconciliation check with ObservedGeneration validation. - Update external E2E postgres container image to version 14.
- Loading branch information
1 parent
3d7bda1
commit 4f460af
Showing
7 changed files
with
112 additions
and
66 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
package e2e | ||
|
||
import ( | ||
"context" | ||
"testing" | ||
"time" | ||
|
||
mmv1beta "github.com/mattermost/mattermost-operator/apis/mattermost/v1beta1" | ||
ptrUtil "github.com/mattermost/mattermost-operator/pkg/utils" | ||
operatortest "github.com/mattermost/mattermost-operator/test" | ||
"github.com/mattermost/mattermost-operator/test/e2e" | ||
"github.com/stretchr/testify/require" | ||
appsv1 "k8s.io/api/apps/v1" | ||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
"k8s.io/apimachinery/pkg/types" | ||
) | ||
|
||
func mattermostUpgradeTest(t *testing.T) { | ||
namespace := "e2e-test-external-services-upgrade" | ||
|
||
testEnv, err := SetupTestEnv(k8sClient, namespace) | ||
require.NoError(t, err) | ||
defer testEnv.CleanupFunc() | ||
|
||
mattermost := &mmv1beta.Mattermost{ | ||
ObjectMeta: metav1.ObjectMeta{ | ||
Name: "test-mm", | ||
Namespace: namespace, | ||
}, | ||
Spec: mmv1beta.MattermostSpec{ | ||
Version: operatortest.PreviousStableMattermostVersion, | ||
Ingress: &mmv1beta.Ingress{ | ||
Host: "e2e-test-example.mattermost.dev", | ||
}, | ||
Replicas: ptrUtil.NewInt32(1), | ||
FileStore: mmv1beta.FileStore{ | ||
External: &testEnv.FileStoreConfig, | ||
}, | ||
Database: mmv1beta.Database{ | ||
External: &testEnv.DBConfig, | ||
}, | ||
}, | ||
} | ||
|
||
expectValidMattermostInstance(t, mattermost) | ||
|
||
mmNamespaceName := types.NamespacedName{Namespace: mattermost.Namespace, Name: mattermost.Name} | ||
|
||
newMattermost := &mmv1beta.Mattermost{} | ||
err = k8sClient.Get(context.TODO(), mmNamespaceName, newMattermost) | ||
require.NoError(t, err) | ||
|
||
// Upgrade to new version | ||
newMattermost.Spec.Version = operatortest.LatestStableMattermostVersion | ||
err = k8sClient.Update(context.TODO(), newMattermost) | ||
require.NoError(t, err) | ||
|
||
// Wait for mattermost to be stable again. | ||
err = e2e.WaitForMattermostStable(t, k8sClient, mmNamespaceName, 3*time.Minute) | ||
require.NoError(t, err) | ||
|
||
var mmDeployment appsv1.Deployment | ||
err = k8sClient.Get(context.TODO(), mmNamespaceName, &mmDeployment) | ||
require.NoError(t, err) | ||
// check if deployment has the new version | ||
require.Equal(t, "mattermost/mattermost-enterprise-edition:"+operatortest.LatestStableMattermostVersion, | ||
mmDeployment.Spec.Template.Spec.Containers[0].Image) | ||
} |
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