Skip to content
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

More fixes for automated integration test (contributes to #71) #316

Merged
merged 4 commits into from
Jun 18, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 8 additions & 10 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,10 @@ steps:
inputs:
versionSpec: "3.x"
displayName: Use Python 3.x
- script: pip install ansible ansible-doc-extractor ansible-lint flake8 sphinx sphinx-rtd-theme yamllint yq
- script: pip install ansible ansible-doc-extractor ansible-lint flake8 fabric-sdk-py openshift python-pkcs11 sphinx sphinx-rtd-theme yamllint yq
displayName: Install Python dependencies
- script: curl -sSL https://github.com/hyperledger/fabric/releases/download/v1.4.7/hyperledger-fabric-linux-amd64-1.4.7.tar.gz | sudo tar xzf - -C /usr/local
displayName: Install Fabric CLI
- script: |
set -ex
curl -sL https://ibm.biz/idt-installer | bash
Expand All @@ -32,7 +34,11 @@ steps:
displayName: Install IBM Cloud and OpenShift CLI
- script: |
set -ex
ansible-galaxy collection build
ibmcloud login --apikey $(IBM Cloud API Key) -c $(IBM Cloud Account) -r $(IBM Cloud Region)
ibmcloud oc cluster config -c $(IBM Cloud OpenShift Cluster ID)
oc login -u apikey -p $(IBM Cloud API Key)
displayName: Log in to IBM Cloud
- script: ansible-galaxy collection build
displayName: Build collection artifact
- script: |
set -ex
Expand All @@ -53,13 +59,6 @@ steps:
shellcheck tutorial/*.sh
yamllint .
displayName: Lint collection
- script: |
set -ex
ibmcloud login --apikey $(IBM Cloud API Key) -c $(IBM Cloud Account) -r $(IBM Cloud Region)
ibmcloud oc cluster config -c $(IBM Cloud OpenShift Cluster ID)
oc login -u apikey -p $(IBM Cloud API Key)
condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/master'))
displayName: Log in to IBM Cloud
- script: |
set -ex
cd ~/.ansible/collections/ansible_collections/ibm/blockchain_platform
Expand All @@ -73,7 +72,6 @@ steps:
yq -yi .test_run_id=\"${TEST_RUN_ID}\" tests/integration/integration_config.yml
yq -yi .short_test_run_id=\"${SHORT_TEST_RUN_ID}\" tests/integration/integration_config.yml
ansible-test integration
condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/master'))
displayName: Run tests
- script: |
set -ex
Expand Down
2 changes: 2 additions & 0 deletions tests/integration/integration_config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ api_endpoint: https://ibp-console.example.org:32000
api_authtype: basic
api_key: xxxxxxxx
api_secret: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
api_timeout: 60
k8s_namespace: ibp
test_run_id: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
short_test_run_id: xxxxxxxx
wait_timeout: 600
27 changes: 26 additions & 1 deletion tests/integration/targets/certificate_authority/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
api_authtype: "{{ api_authtype | mandatory }}"
api_key: "{{ api_key | mandatory }}"
api_secret: "{{ api_secret | mandatory }}"
api_timeout: "{{ api_timeout | mandatory }}"
ca_name: "Test CA {{ short_test_run_id }}"
ca_config_override:
ca:
Expand All @@ -29,7 +30,7 @@
hf.AffiliationMgr: true
k8s_namespace: "{{ k8s_namespace | mandatory }}"
k8s_name: "testca{{ short_test_run_id }}"
wait_timeout: 600
wait_timeout: "{{ wait_timeout | mandatory }}"

- name: Run tests
block:
Expand Down Expand Up @@ -95,6 +96,30 @@
expected_storage_class: default
expected_storage_size: 20Gi

- name: Ensure idempotency
ibm.blockchain_platform.certificate_authority:
state: present
<<: *ibp_connection_info
name: "{{ ca_name }}"
config_override: "{{ ca_config_override }}"
resources:
ca:
requests:
cpu: 200m
memory: 400M
wait_timeout: "{{ wait_timeout }}"
register: result

- include_tasks: assertions.yml
vars:
expected_change: no
expected_enrollment_id: admin
expected_enrollment_secret: adminpw
expected_cpu: 200m
expected_memory: 400M
expected_storage_class: default
expected_storage_size: 20Gi

always:
- name: Delete certificate authority
ibm.blockchain_platform.certificate_authority:
Expand Down