Skip to content

e2e tests: migrate the memcached molecule tests to use the new layout (1.0+) with mock samples stack#4011

Merged
camilamacedo86 merged 1 commit intooperator-framework:masterfrom
camilamacedo86:molecule-ansible
Oct 23, 2020
Merged

e2e tests: migrate the memcached molecule tests to use the new layout (1.0+) with mock samples stack#4011
camilamacedo86 merged 1 commit intooperator-framework:masterfrom
camilamacedo86:molecule-ansible

Conversation

@camilamacedo86
Copy link
Copy Markdown
Contributor

@camilamacedo86 camilamacedo86 commented Oct 11, 2020

Description of the change:

  • Replace the test/memcahced-operator used in the molecule tests by a mock generated with samples

Motivation for the change:

  • molecule tests are executed with the new layout. Same purpose of Kubebuilder layout ansible tests, by Fabian #3433.
  • ensure that the mock used is a project built with the bin and with the latest changes done in the prs
  • ensure that users will be able to test the sample with the molecule and its tests will work as well.
  • maintainability

PS: We can check the Memcached mock project used to run the molecule tests by exec go run ./hack/generate/samples/molecule/generate.go Then, we can see the project in the testdata/ansible/memcached-molecule-operator with all molecule tests and checks.

NOTE as a follow up we need to do the test/ansible also be in the new layout and mocked via sample stack. See: #4025

Closes: #3540

Comment thread Makefile

samples: ## Generate samples
go run ./hack/generate/samples/generate_all.go
go run ./hack/generate/samples/generate_testdata.go
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

make more sense be generate_testdata
it also makes more simplicity its goal.

@@ -27,13 +27,14 @@ import (
"github.com/operator-framework/operator-sdk/internal/testutils"
)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just moving the vars to the main for not let them global in the pkg.

memcached.Prepare()
memcached.Run()
}

Copy link
Copy Markdown
Contributor Author

@camilamacedo86 camilamacedo86 Oct 11, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The consts were centralized in the constants.go file.

Comment thread testdata/ansible/memcached-operator/watches.yaml
@camilamacedo86 camilamacedo86 changed the title e2e tests: migrate molecute tests to use the new layout (1.0+) with m… e2e tests: migrate molecute tests to use the new layout (1.0+) with mock samples stack Oct 11, 2020
@camilamacedo86 camilamacedo86 added language/ansible Issue is related to an Ansible operator project area/testing Issue related to testing the operator-sdk and subcomponents labels Oct 11, 2020
@fabianvf

This comment has been minimized.

@camilamacedo86

This comment has been minimized.

@fabianvf
Copy link
Copy Markdown
Member

@camilamacedo86 yeah, the memcached tests look like they were properly captured, but the tests in test/ansible/ were for more advanced features unrelated to the memcached example or scaffolding

@camilamacedo86 camilamacedo86 changed the title e2e tests: migrate molecute tests to use the new layout (1.0+) with mock samples stack WIP: e2e tests: migrate molecute tests to use the new layout (1.0+) with mock samples stack Oct 12, 2020
@openshift-ci-robot openshift-ci-robot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Oct 12, 2020
@camilamacedo86 camilamacedo86 changed the title WIP: e2e tests: migrate molecute tests to use the new layout (1.0+) with mock samples stack e2e tests: migrate molecute tests to use the new layout (1.0+) with mock samples stack Oct 13, 2020
@openshift-ci-robot openshift-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Oct 13, 2020
cd $TMPDIR
KUSTOMIZE_PATH=${KUSTOMIZE}
header_text "Test Ansible Molecule scenarios"
pushd "${ROOTDIR}/test/ansible"
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See that a pr to change it will be done as a follow up: https://github.com/operator-framework/operator-sdk/pull/4011/files

c/c @asmacdo @fabianvf

@openshift-ci-robot openshift-ci-robot added needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. and removed needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. labels Oct 15, 2020
@camilamacedo86 camilamacedo86 changed the title e2e tests: migrate molecute tests to use the new layout (1.0+) with mock samples stack e2e tests: migrate the memcached molecule tests to use the new layout (1.0+) with mock samples stack Oct 17, 2020
Copy link
Copy Markdown
Member

@fabianvf fabianvf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Oct 20, 2020
@openshift-ci-robot
Copy link
Copy Markdown

New changes are detected. LGTM label has been removed.

Comment thread Makefile Outdated
@camilamacedo86 camilamacedo86 merged commit a62133f into operator-framework:master Oct 23, 2020
@camilamacedo86 camilamacedo86 deleted the molecule-ansible branch October 23, 2020 11:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/testing Issue related to testing the operator-sdk and subcomponents language/ansible Issue is related to an Ansible operator project

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Port the tests in test/ansible for the new layout

4 participants