Skip to content
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
6 changes: 6 additions & 0 deletions docs/releases/pending/4391.fmf
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
description: |
The :ref:`/plugins/discover/shell` discover plugin now supports
the ``url-content-type`` key, which is handled in the same way
as in the :ref:`/plugins/discover/fmf` discover plugin.
The plugin now also correctly installs test dependencies
specified in the ``require`` and ``recommend`` keys.
13 changes: 12 additions & 1 deletion tests/discover/archive.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,25 @@ rlJournalStart
rlRun "pushd data"
rlPhaseEnd

rlPhaseStartTest "Basic archive tests"
rlPhaseStartTest "Basic archive tests (fmf)"
plan="/plans/fmf/archive-url"
rlRun -s "tmt run -i $run discover plans -n $plan"
rlAssertGrep "2 tests selected" $rlRun_LOG
plan_path="$run$plan"
step_workdir="$plan_path/discover/default-0"
rlAssertExists "$step_workdir/tests-main.tar.gz" 0 "Check that the archive is present"
rlAssertExists "$step_workdir/tests/tests-main" 0 "Check that the extracted archive is present"
rlAssertExists "$step_workdir/tests/tests-main/scripts/random_file.sh" 0 "Check that there is a script in the extracted archive"
rlPhaseEnd

rlPhaseStartTest "Basic archive tests (shell)"
plan="/plans/shell/archive-url"
rlRun -s "tmt run -i $run discover plans -n $plan"
plan_path="$run$plan"
step_workdir="$plan_path/discover/default-0"
rlAssertExists "$step_workdir/tests-main.tar.gz" 0 "Check that the archive is present"
rlAssertExists "$step_workdir/tests/tests-main" 0 "Check that the extracted archive is present"
rlAssertExists "$step_workdir/tests/tests-main/scripts/random_file.sh" 0 "Check that there is a script in the extracted archive"
rlPhaseEnd

rlPhaseStartCleanup
Expand Down
10 changes: 10 additions & 0 deletions tests/discover/data/plans.fmf
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,16 @@ execute:
branch: fedora
discover+:
ref: "@tests/discover/data/dynamic-ref.fmf"
/archive-url:
summary: Test url-type archive
discover:
how: shell
url: https://github.com/teemtee/tests/archive/refs/heads/main.tar.gz
url-content-type: archive
tests:
- name: directory is there
test: test -d tests
path: /tests-main

/fmf:
/url:
Expand Down
10 changes: 10 additions & 0 deletions tests/discover/keep-git-metadata/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,16 @@ rlJournalStart
rlAssertGrep "keep-git-metadata.*can be used only" $rlRun_LOG
rlPhaseEnd

rlPhaseStartTest "git root is parent of fmf root while remote url is specified"
rlRun "git_repo=\$(mktemp -d)"
rlRun "mkdir $git_repo/fmf_root"
rlRun "cp $tmp/data/plan.fmf $git_repo/fmf_root"
rlRun "pushd $git_repo && git init"
rlRun "pushd fmf_root && tmt init"
rlRun -s "tmt run plan -n /url/keep"
rlAssertNotGrep "keep-git-metadata.*can be used only" $rlRun_LOG
rlPhaseEnd

rlPhaseStartCleanup
rlRun "popd && popd && popd"
rlRun "rm -rf $tmp $git_repo" 0 "Remove run directory"
Expand Down
2 changes: 1 addition & 1 deletion tests/usability/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ rlJournalStart
rlRun -s "tmt run --rm pl disc -vvvddd -h local 2>&1" "1-255"
rlAssertGrep "Unsupported discover method 'local'" $rlRun_LOG
rlRun -s "tmt run --rm pl disc -vvvddd provi -h local"
rlRun "grep -A1 discover $rlRun_LOG | grep 'how: fmf'"
rlRun "grep -A 20 discover $rlRun_LOG | grep 'how: fmf'"
rlRun "grep -A1 provision $rlRun_LOG | grep 'how: local'"
rlRun -s "tmt run --rm pl disc -v provN -h local 2>&1" "1-255"
rlAssertGrep "Invalid subcommand of 'run'" $rlRun_LOG
Expand Down
8 changes: 7 additions & 1 deletion tmt/schemas/discover/shell.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,16 @@ properties:
$ref: "/schemas/core#/definitions/summary"

url:
$ref: "/schemas/common#/definitions/fmf_id/properties/url"

url-content-type:
type: string
enum:
- git
- archive

ref:
type: string
$ref: "/schemas/common#/definitions/fmf_id/properties/ref"

dist-git-source:
$ref: "/schemas/common#/definitions/dist-git-source"
Expand Down
Loading