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

Setup testmo integration #204

Open
wants to merge 23 commits into
base: main
Choose a base branch
from
Open
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
14 changes: 14 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,16 @@ jobs:
run: |
echo "OAREPO_VERSION: >>>$OAREPO_VERSION<<< >>>${{ inputs.oarepo }}<<<"
- uses: actions/checkout@v3
- uses: actions/setup-node@v4
with:
node-version: 19
- run: npm install --no-save @testmo/testmo-cli
- run: |
npx testmo automation:resources:add-field --name git --type string \
--value ${GITHUB_SHA:0:7} --resources resources.json
RUN_URL="$GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID"
npx testmo automation:resources:add-link --name build \
--url $RUN_URL --resources resources.json
- name: Set up Python
uses: actions/setup-python@v3
with:
Expand Down Expand Up @@ -66,6 +76,10 @@ jobs:
redis-version: ${{ matrix.redis-version }}

- name: Run tests
env:
TESTMO_TOKEN: ${{ secrets.TESTMO_TOKEN }}
TESTMO_ORG_NAME: ${{ secrets.TESTMO_ORG_NAME }}
TESTMO_PROJECT_ID: ${{ secrets.TESTMO_PROJECT_ID }}
run: |
./run-tests.sh

Expand Down
1 change: 1 addition & 0 deletions .github/workflows/push.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ permissions:
jobs:
build12:
uses: ./.github/workflows/build.yaml
secrets: inherit
with:
oarepo: "12"

Expand Down
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -92,4 +92,6 @@ thesis
dist
.vscode

/thesis
/thesis

.tests
30 changes: 26 additions & 4 deletions run-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,31 @@ pip install uritemplate

invenio index destroy --force --yes-i-know || true

## run OOM separately as it needs its own configuration of logging
pytest -m "not oom" tests
pytest -m "oom" tests
wrap_command_for_testmo() {
cmd="$1"
shift

if [ -z "$TESTMO_TOKEN" ]; then
"${cmd}" "$@"
else
if [ -d .tests/results ] ; then
rm -rf .tests/results
fi
echo "Running tests with testmo"
GITHUB_REPO_SHORT=${GITHUB_REPOSITORY#*/}

npx testmo automation:run:submit \
--instance "https://${TESTMO_ORG_NAME}.testmo.net" \
--project-id "${TESTMO_PROJECT_ID}" \
--name "Test Run ${GITHUB_REPOSITORY} @ ${GITHUB_REF_NAME}" \
--source "${GITHUB_REPO_SHORT}" \
--results .tests/results/*.xml \
-- "${cmd}" "$@"
fi
}

wrap_command_for_testmo pytest -m "not oom" --junitxml=.tests/results/result.xml tests
wrap_command_for_testmo pytest -m "oom" --junitxml=.tests/results/result.xml tests


test -d $VENV/var/instance || mkdir $VENV/var/instance
Expand All @@ -77,4 +99,4 @@ sleep 5

python3 tests/records2_async_data/generate_async_data_for_import.py /tmp/sample-records-for-import 100
invenio oarepo fixtures load --no-system-fixtures /tmp/sample-records-for-import --on-background --bulk-size 10
python3 tests/records2_async_data/check_async_data_loaded.py 100
python3 tests/records2_async_data/check_async_data_loaded.py 100
11 changes: 11 additions & 0 deletions tests/test_testmo_integration.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
def test_testmo_integration(record_property):
#record_property("author", "mirekys")
#record_property("text:description", "This test case evaluates integration features of Testmo")
#record_property("url:github", "https://github.com/oarepo/oarepo-runtime/tests/test_testmo_integration.py")

# Testmo also supports automation steps, including statuses & sub fields
#record_property("step[passed]", "Check if sky is blue")
assert True

#record_property("step", "Check if cows are purple")
assert False

Check failure on line 11 in tests/test_testmo_integration.py

View workflow job for this annotation

GitHub Actions / build12 / build

test_testmo_integration assert False
Loading