Skip to content

Commit

Permalink
Install collection for component tests with sudo
Browse files Browse the repository at this point in the history
  • Loading branch information
jakubrak committed Oct 15, 2024
1 parent b4efa60 commit 146365f
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,29 +12,27 @@
# See the License for the specific language governing permissions and
# limitations under the License.

name: run-tests
description: Runs the tests
name: run-component-tests
description: Runs component tests

runs:
using: composite
steps:
- name: Install the collection
shell: bash
run: ansible-galaxy collection install -vvv dynatrace-oneagent*
- name: Run sanity test
shell: bash
run: pushd ~/.ansible/collections/ansible_collections/dynatrace/oneagent && ansible-test sanity && popd
- name: Prepare component tests
id: prepare-component-tests
- name: Prepare Python environment
shell: bash
run: python -m virtualenv roles/oneagent/tests/component/venv &&
source roles/oneagent/tests/component/venv/bin/activate &&
pip install -r roles/oneagent/tests/component/resources/requirements.txt

- name: Install the collection
shell: bash
run: sudo bash -c "source roles/oneagent/tests/component/venv/bin/activate && ansible-galaxy collection install -vvv dynatrace-oneagent*"

- name: Run component tests
id: component-tests
shell: bash
run: cd roles/oneagent/tests/component &&
sudo bash -c "source venv/bin/activate; python run.py --linux_x86=localhost"
sudo bash -c "source venv/bin/activate && python run.py --linux_x86=localhost"

- name: Upload logs
uses: actions/upload-artifact@v4
if: ${{ always() }}
Expand Down
27 changes: 27 additions & 0 deletions .github/actions/run-sanity-tests/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Copyright 2024 Dynatrace LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

name: run-sanity-tests
description: Runs sanity tests

runs:
using: composite
steps:
- name: Install the collection
shell: bash
run: ansible-galaxy collection install -vvv dynatrace-oneagent*

- name: Run sanity test
shell: bash
run: pushd ~/.ansible/collections/ansible_collections/dynatrace/oneagent && ansible-test sanity && popd
6 changes: 4 additions & 2 deletions .github/workflows/build-and-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,7 @@ jobs:
uses: ./.github/actions/setup-build-environment
- name: Build the collection
uses: ./.github/actions/build-collection
- name: Run tests
uses: ./.github/actions/run-tests
- name: Run sanity tests
uses: ./.github/actions/run-sanity-tests
- name: Run component tests
uses: ./.github/actions/run-component-tests
6 changes: 4 additions & 2 deletions .github/workflows/build-test-and-publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,10 @@ jobs:
uses: ./.github/actions/setup-build-environment
- name: Build the collection
uses: ./.github/actions/build-collection
- name: Run tests
uses: ./.github/actions/run-tests
- name: Run sanity tests
uses: ./.github/actions/run-sanity-tests
- name: Run component tests
uses: ./.github/actions/run-component-tests
- name: Publish to Ansible Galaxy
uses: ./.github/actions/publish-to-ansible-galaxy
with:
Expand Down
6 changes: 4 additions & 2 deletions .github/workflows/build-test-and-upload.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ jobs:
uses: ./.github/actions/setup-build-environment
- name: Build the collection
uses: ./.github/actions/build-collection
- name: Run tests
uses: ./.github/actions/run-tests
- name: Run sanity tests
uses: ./.github/actions/run-sanity-tests
- name: Run component tests
uses: ./.github/actions/run-component-tests
- name: Upload the collection
uses: ./.github/actions/upload-collection

0 comments on commit 146365f

Please sign in to comment.