From 21d24eeb8d5948124be865f9fc5d6ae299dcd85b Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Fri, 16 Apr 2021 11:47:37 +0200 Subject: [PATCH] [netinstall] Add tests for fallback loading - first success that has data is kept --- src/modules/netinstall/Tests.cpp | 5 ++- .../netinstall/tests/1b-single-large.conf | 7 ++++ .../netinstall/tests/1d-fallback-large.conf | 10 +++++ .../netinstall/tests/1d-fallback-small.conf | 10 +++++ src/modules/netinstall/tests/data-large.yaml | 38 +++++++++++++++++++ 5 files changed, 69 insertions(+), 1 deletion(-) create mode 100644 src/modules/netinstall/tests/1b-single-large.conf create mode 100644 src/modules/netinstall/tests/1d-fallback-large.conf create mode 100644 src/modules/netinstall/tests/1d-fallback-small.conf create mode 100644 src/modules/netinstall/tests/data-large.yaml diff --git a/src/modules/netinstall/Tests.cpp b/src/modules/netinstall/Tests.cpp index 06223a709..ff7d8b253 100644 --- a/src/modules/netinstall/Tests.cpp +++ b/src/modules/netinstall/Tests.cpp @@ -345,9 +345,12 @@ ItemTests::testUrlFallback_data() QTest::newRow( "bad" ) << "1a-single-bad.conf" << smash( S::FailedBadConfiguration ) << 0; QTest::newRow( "empty" ) << "1a-single-empty.conf" << smash( S::FailedNoData ) << 0; QTest::newRow( "error" ) << "1a-single-error.conf" << smash( S::FailedBadData ) << 0; - QTest::newRow( "second" ) << "1b-single-small.conf" << smash( S::Ok ) << 2; + QTest::newRow( "two" ) << "1b-single-small.conf" << smash( S::Ok ) << 2; + QTest::newRow( "five" ) << "1b-single-large.conf" << smash( S::Ok ) << 5; QTest::newRow( "none" ) << "1c-none.conf" << smash( S::FailedNoData ) << 0; QTest::newRow( "unset" ) << "1c-unset.conf" << smash( S::FailedNoData ) << 0; + QTest::newRow( "fallback-small" ) << "1d-fallback-small.conf" << smash( S::Ok ) << 2; + QTest::newRow( "fallback-large" ) << "1d-fallback-large.conf" << smash( S::Ok ) << 5; } void diff --git a/src/modules/netinstall/tests/1b-single-large.conf b/src/modules/netinstall/tests/1b-single-large.conf new file mode 100644 index 000000000..eee67e664 --- /dev/null +++ b/src/modules/netinstall/tests/1b-single-large.conf @@ -0,0 +1,7 @@ +# SPDX-FileCopyrightText: no +# SPDX-License-Identifier: CC0-1.0 +# +--- +required: true +groupsUrl: + - file://$TESTDIR/data-large.yaml diff --git a/src/modules/netinstall/tests/1d-fallback-large.conf b/src/modules/netinstall/tests/1d-fallback-large.conf new file mode 100644 index 000000000..5abb05ca8 --- /dev/null +++ b/src/modules/netinstall/tests/1d-fallback-large.conf @@ -0,0 +1,10 @@ +# SPDX-FileCopyrightText: no +# SPDX-License-Identifier: CC0-1.0 +# +--- +required: true +groupsUrl: + - file://$TESTDIR/data-nonexistent.yaml + - file://$TESTDIR/data-bad.yaml + - file://$TESTDIR/data-large.yaml + - file://$TESTDIR/data-small.yaml diff --git a/src/modules/netinstall/tests/1d-fallback-small.conf b/src/modules/netinstall/tests/1d-fallback-small.conf new file mode 100644 index 000000000..e38a7d65f --- /dev/null +++ b/src/modules/netinstall/tests/1d-fallback-small.conf @@ -0,0 +1,10 @@ +# SPDX-FileCopyrightText: no +# SPDX-License-Identifier: CC0-1.0 +# +--- +required: true +groupsUrl: + - file://$TESTDIR/data-nonexistent.yaml + - file://$TESTDIR/data-bad.yaml + - file://$TESTDIR/data-small.yaml + - file://$TESTDIR/data-large.yaml diff --git a/src/modules/netinstall/tests/data-large.yaml b/src/modules/netinstall/tests/data-large.yaml new file mode 100644 index 000000000..7b47aa3b6 --- /dev/null +++ b/src/modules/netinstall/tests/data-large.yaml @@ -0,0 +1,38 @@ +# SPDX-FileCopyrightText: no +# SPDX-License-Identifier: CC0-1.0 +# +- name: "Default" + description: "Default group" + hidden: false + selected: true + critical: false + packages: + - base +- name: "Two" + description: "group 2" + hidden: false + selected: true + critical: false + packages: + - chakra-live-two +- name: "Three" + description: "group 3" + hidden: false + selected: true + critical: false + packages: + - chakra-live-three +- name: "Four" + description: "group 4" + hidden: false + selected: true + critical: false + packages: + - chakra-live-four +- name: "Five" + description: "group 5" + hidden: false + selected: true + critical: false + packages: + - chakra-live-five