Skip to content

e2e-tests: auto generate advanced molecule ansible tests with samples… #4312

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Dec 18, 2020
Merged

e2e-tests: auto generate advanced molecule ansible tests with samples… #4312

merged 3 commits into from
Dec 18, 2020

Conversation

camilamacedo86
Copy link
Contributor

@camilamacedo86 camilamacedo86 commented Dec 14, 2020

Description

Replace static mock test/ansible by auto-generated mock via samples stack

Motivation for the change:

Ensure that e2e molecule tests are done with the PR changes by automating its generation. Otherwise, we cannot check if a change in the scaffold files could break it.

Closes: #4025

Note: To check the scenario locally run go run ./hack/generate/samples/molecule/generate.go the advanced-molecule-operator will be generate in the testdata. Then, it can be checked for development purposes.

@camilamacedo86 camilamacedo86 changed the title e2e-tests: auto generate advanced molecule ansible tests with samples… WIP: e2e-tests: auto generate advanced molecule ansible tests with samples… Dec 14, 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 Dec 14, 2020
camilamacedo86 added a commit that referenced this pull request Dec 15, 2020
**Description of the change:**
- update advanced mock static scenario with 1.0+ layout (#3433) - (note that we need to ensure that the test works with the new layout)
- Fix CI issue (blocker master):  `The error was: urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='172.30.99.1', port=24443): Max retries exceeded with url: /version (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7f28647cdb38>: Failed to establish a new connection: [Errno 110] Connection timed out',))` in GA.

NOTE: The follow up here is to replace the test/ansible static mock with samples to ensure that we are testing it with the latest changes always. See the issue #4025 and its PR : #4312
@camilamacedo86 camilamacedo86 changed the title WIP: e2e-tests: auto generate advanced molecule ansible tests with samples… e2e-tests: auto generate advanced molecule ansible tests with samples… Dec 16, 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 Dec 16, 2020
Copy link
Member

@jmrodri jmrodri left a comment

Choose a reason for hiding this comment

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

There is a typo. But in general what if this PR doesn't merge? While I understand what we're trying to do, I'm not 100% sure if this easier to maintain.


header_text "Test Ansible Molecule scenarios"
pushd "${ROOTDIR}/test/ansible"
header_text "Running Defualt test with advanced-molecule-operator/"
Copy link
Member

Choose a reason for hiding this comment

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

typo should read "Default"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed

@camilamacedo86
Copy link
Contributor Author

camilamacedo86 commented Dec 18, 2020

Hi @jmrodri.

Just to clarifies. We are not replacing here a shell script by a go stack.
Currently, we have a mock project in the test/ansible which would requires manually updates and checkes in all reviews after any change in the scaffolds. Indeed if it is a bump of a new version of Kubebuilder be made since it could impact that as well.

Then, this PR solves this problem. After that, we are generating automatically the sample used for molecule tests. See that the e2e molecule runs 2 tests. One is based on a Memcached project with its specific scenarios which is automated by the go samples stack already. The other one runs using as mock the /test/ansible.

But in general what if this PR doesn't merge? While I understand what we're trying to do, I'm not 100% sure if this easier to maintain.

It makes it very easier since is :

  • we are following here the same approach applied accross the project to generate the samples + to build the other mock data used by the e2e molecule tests.
  • we no longer need to check and update the test/ansible after any change made

PS.: We still able to just run the molecule generate go file and check the testdata created for development purpose as local tests as well. See the makefile call. (go run ./hack/generate/samples/molecule/generate.go)

All your suggestions are addressed as well. Really tks.

@jmrodri
Copy link
Member

jmrodri commented Dec 18, 2020

@camilamacedo86 okay. That makes a lot of sense.

Copy link
Member

@jmrodri jmrodri 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 Dec 18, 2020
@openshift-ci-robot openshift-ci-robot removed the lgtm Indicates that a PR is ready to be merged. label Dec 18, 2020
@@ -20,6 +20,7 @@ website/tech-doc-hugo

# Ignore molecule samples testdata if it be generated in the testdata/ diretory
testdata/ansible/memcached-molecule-operator
testdata/ansible/advanced-molecule-operator
Copy link
Member

Choose a reason for hiding this comment

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

+1 good name

"github.com/operator-framework/operator-sdk/internal/testutils"
)

// MoleculeAnsible defines the context for the sample
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
// MoleculeAnsible defines the context for the sample
// AdcancedMolecule defines the context for the sample

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed

k8s_info:
api_version: v1
kind: ConfigMap
namespace: '{{ meta.namespace }}'
Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No. Because we pass in the watches file the var meta. see;

- version: v1alpha1
group: test.example.com
kind: ReconciliationTest
playbook: playbooks/reconciliationtest.yml
vars:
meta: '{{ ansible_operator_meta }}'

Copy link
Member

Choose a reason for hiding this comment

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

hmm. IMO we ought to remove that and just access ansible_operator_meta directly. That said, it does not need to be in this PR, just something I noticed.

Copy link
Member

@asmacdo asmacdo 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 Dec 18, 2020
@camilamacedo86 camilamacedo86 merged commit 50fcdb8 into operator-framework:master Dec 18, 2020
@camilamacedo86 camilamacedo86 deleted the mocule-samples branch December 18, 2020 18:59
reinvantveer pushed a commit to reinvantveer/operator-sdk that referenced this pull request Feb 5, 2021
**Description of the change:**
- update advanced mock static scenario with 1.0+ layout (operator-framework#3433) - (note that we need to ensure that the test works with the new layout)
- Fix CI issue (blocker master):  `The error was: urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='172.30.99.1', port=24443): Max retries exceeded with url: /version (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7f28647cdb38>: Failed to establish a new connection: [Errno 110] Connection timed out',))` in GA.

NOTE: The follow up here is to replace the test/ansible static mock with samples to ensure that we are testing it with the latest changes always. See the issue operator-framework#4025 and its PR : operator-framework#4312
Signed-off-by: reinvantveer <[email protected]>
reinvantveer pushed a commit to reinvantveer/operator-sdk that referenced this pull request Feb 5, 2021
operator-framework#4312)

**Description**

Replace static mock test/ansible by auto-generated mock via samples stack

**Motivation for the change:**

Ensure that e2e molecule tests are done with the PR changes by automating its generation. Otherwise, we cannot check if a change in the scaffold files could break it. 

Closes: operator-framework#4025


**Note**: To check the scenario locally run ` go run ./hack/generate/samples/molecule/generate.go` the advanced-molecule-operator will be generate in the testdata. Then, it can be checked for development purposes. 

Signed-off-by: reinvantveer <[email protected]>
rearl-scwx pushed a commit to rearl-scwx/operator-sdk that referenced this pull request Feb 5, 2021
**Description of the change:**
- update advanced mock static scenario with 1.0+ layout (operator-framework#3433) - (note that we need to ensure that the test works with the new layout)
- Fix CI issue (blocker master):  `The error was: urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='172.30.99.1', port=24443): Max retries exceeded with url: /version (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7f28647cdb38>: Failed to establish a new connection: [Errno 110] Connection timed out',))` in GA.

NOTE: The follow up here is to replace the test/ansible static mock with samples to ensure that we are testing it with the latest changes always. See the issue operator-framework#4025 and its PR : operator-framework#4312
Signed-off-by: rearl <[email protected]>
rearl-scwx pushed a commit to rearl-scwx/operator-sdk that referenced this pull request Feb 5, 2021
operator-framework#4312)

**Description**

Replace static mock test/ansible by auto-generated mock via samples stack

**Motivation for the change:**

Ensure that e2e molecule tests are done with the PR changes by automating its generation. Otherwise, we cannot check if a change in the scaffold files could break it. 

Closes: operator-framework#4025


**Note**: To check the scenario locally run ` go run ./hack/generate/samples/molecule/generate.go` the advanced-molecule-operator will be generate in the testdata. Then, it can be checked for development purposes. 
Signed-off-by: rearl <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lgtm Indicates that a PR is ready to be merged.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Replace the test/ansible static files by a mock data generated with the samples stack
4 participants