Skip to content

Commit

Permalink
Refactor integration tests (#1191)
Browse files Browse the repository at this point in the history
* Refactor integration tests

- Use OCP release version 4.9 for deployment config apps
- Remove MongoDB from OCP apps because this app is not dropped from
external templates
- Call `Reset` before calling `Initialize` for the application

* Retrigger  CI

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
  • Loading branch information
viveksinghggits and mergify[bot] committed Jan 20, 2022
1 parent cdc321c commit bfe366c
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 15 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ DOCKER_CONFIG ?= "$(HOME)/.docker"
# Mention the vm-driver that should be used to install OpenShift
vm-driver ?= "kvm"
# Default OCP version in which the OpenShift apps are going to run
ocp_version ?= "4.7"
ocp_version ?= "4.9"
###
### These variables should not need tweaking.
###
Expand Down Expand Up @@ -88,7 +88,7 @@ all-push: $(addprefix push-, $(ALL_ARCH))

build: bin/$(ARCH)/$(BIN)

build-controller:
build-controller:
@$(MAKE) run CMD='-c " \
goreleaser build --id $(BIN) --rm-dist --debug --snapshot \
&& cp dist/$(BIN)_linux_$(ARCH)/$(BIN) bin/$(ARCH)/$(BIN) \
Expand Down
8 changes: 5 additions & 3 deletions build/integration-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@ SHORT_APPS="^PostgreSQL$|^PITRPostgreSQL|^MySQL$|Elasticsearch|^MongoDB$|Maria|^
OC_APPS3_11="MysqlDBDepConfig$|MongoDBDepConfig$|PostgreSQLDepConfig$"
OC_APPS4_4="MysqlDBDepConfig4_4|MongoDBDepConfig4_4|PostgreSQLDepConfig4_4"
OC_APPS4_5="MysqlDBDepConfig4_5|MongoDBDepConfig4_5|PostgreSQLDepConfig4_5"
OC_APPS4_7="MysqlDBDepConfig4_7|MongoDBDepConfig4_7|PostgreSQLDepConfig4_7"
# MongoDB is not provided as external DB template in release 4.9 anymore
# https://github.com/openshift/origin/commit/4ea9e6c5961eb815c200df933eee30c48a5c9166
OC_APPS4_9="MysqlDBDepConfig4_9|PostgreSQLDepConfig4_9"

check_dependencies() {
# Check if minio is already deployed
Expand Down Expand Up @@ -85,8 +87,8 @@ case "${1}" in
"4.5")
TEST_APPS=${OC_APPS4_5}
;;
"4.7")
TEST_APPS=${OC_APPS4_7}
"4.9")
TEST_APPS=${OC_APPS4_9}
;;
*)
usage
Expand Down
2 changes: 1 addition & 1 deletion build/minio.sh
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ usage() {
Usage: ${0} <operation>
Where operation is one of the following:
install_minio: installs minio on k8s cluster
uninstall_minio: uninstalls minio
uninstall_minio: uninstalls minio
EOM
exit 1
}
Expand Down
17 changes: 8 additions & 9 deletions pkg/testing/integration_register.go
Original file line number Diff line number Diff line change
Expand Up @@ -384,43 +384,42 @@ var _ = Suite(&Kafka{
},
})

// OpenShift apps for version 4.7
// Mysql Instance that is deployed through DeploymentConfig on OpenShift cluster
type MysqlDBDepConfig4_7 struct {
type MysqlDBDepConfig4_9 struct {
IntegrationSuite
}

var _ = Suite(&MysqlDBDepConfig4_7{
var _ = Suite(&MysqlDBDepConfig4_9{
IntegrationSuite{
name: "mysqldc",
namespace: "mysqldc4-7-test",
namespace: "mysqldc4-9-test",
app: app.NewMysqlDepConfig("mysqldeploymentconfig", app.TemplateVersionOCP4_9, app.EphemeralStorage, "8.0"),
bp: app.NewBlueprint("mysql-dep-config", "", true),
profile: newSecretProfile(),
},
})

// MongoDB deployed on openshift cluster
type MongoDBDepConfig4_7 struct {
type MongoDBDepConfig4_9 struct {
IntegrationSuite
}

var _ = Suite(&MongoDBDepConfig4_7{
var _ = Suite(&MongoDBDepConfig4_9{
IntegrationSuite{
name: "mongodb",
namespace: "mongodb4-7-test",
namespace: "mongodb4-9-test",
app: app.NewMongoDBDepConfig("mongodeploymentconfig", app.TemplateVersionOCP4_9, app.EphemeralStorage),
bp: app.NewBlueprint("mongo-dep-config", "", true),
profile: newSecretProfile(),
},
})

// PostgreSQL deployed on openshift cluster
type PostgreSQLDepConfig4_7 struct {
type PostgreSQLDepConfig4_9 struct {
IntegrationSuite
}

var _ = Suite(&PostgreSQLDepConfig4_7{
var _ = Suite(&PostgreSQLDepConfig4_9{
IntegrationSuite{
name: "postgresdepconf",
namespace: "postgresdepconf4-5-test",
Expand Down
3 changes: 3 additions & 0 deletions pkg/testing/integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,9 @@ func (s *IntegrationSuite) TestRun(c *C) {
err = pingAppAndWait(ctx, a)
c.Assert(err, IsNil)

err = a.Reset(ctx)
c.Assert(err, IsNil)

err = a.Initialize(ctx)
c.Assert(err, IsNil)

Expand Down

0 comments on commit bfe366c

Please sign in to comment.