Skip to content

Commit

Permalink
Merge pull request advancedtelematic#7 from cajun-rat/tidy/tests
Browse files Browse the repository at this point in the history
Tidy up tests
  • Loading branch information
pattivacek authored Jul 12, 2021
2 parents f6eb62d + a882b9f commit 819c82c
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 12 deletions.
2 changes: 1 addition & 1 deletion src/libaktualizr/uptane/uptane_network_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ TEST(UptaneNetwork, DownloadFailure) {
*/
class HttpUnstable : public HttpFake {
public:
HttpUnstable(const boost::filesystem::path &test_dir_in) : HttpFake(test_dir_in, "hasupdates") {}
explicit HttpUnstable(const boost::filesystem::path &test_dir_in) : HttpFake(test_dir_in, "hasupdates") {}
HttpResponse get(const std::string &url, int64_t maxsize) override {
if (!connectSwitch) {
return HttpResponse({}, 503, CURLE_OK, "");
Expand Down
24 changes: 13 additions & 11 deletions src/sota_tools/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ if (BUILD_SOTA_TOOLS)
# Abort when given a bogus OSTree ref.
add_test(NAME garage-push-missing-ref
COMMAND ${PROJECT_SOURCE_DIR}/tests/sota_tools/test-missing-ref $<TARGET_FILE:garage-push>
${SOTA_PACKED_CREDENTIALS}
${PROJECT_SOURCE_DIR}/tests/test_data/credentials.zip
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/tests/)

# Abort when given nonexistent credentials.
Expand Down Expand Up @@ -321,13 +321,13 @@ if (BUILD_SOTA_TOOLS)

# Support debug logging.
add_test(NAME garage-deploy-debug-logging
COMMAND garage-deploy -f ${SOTA_PACKED_CREDENTIALS} -p ${SOTA_PACKED_CREDENTIALS} --commit 123 -h 3 --name 123 -v
COMMAND garage-deploy -f tests/test_data/credentials.zip -p tests/test_data/credentials.zip --commit 123 -h 3 --name 123 -v
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR})
set_tests_properties(garage-deploy-debug-logging PROPERTIES PASS_REGULAR_EXPRESSION "Debug level debugging enabled" LABELS "credentials")

# Support trace logging.
add_test(NAME garage-deploy-trace-logging
COMMAND garage-deploy -f ${SOTA_PACKED_CREDENTIALS} -p ${SOTA_PACKED_CREDENTIALS} --commit 16ef2f2629dc9263fdf3c0f032563a2d757623bbc11cf99df25c3c3f258dccbe -h 3 --name 123 --loglevel 0
COMMAND garage-deploy -f tests/test_data/credentials.zip -p tests/test_data/credentials.zip --commit 16ef2f2629dc9263fdf3c0f032563a2d757623bbc11cf99df25c3c3f258dccbe -h 3 --name 123 --loglevel 0
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR})
set_tests_properties(garage-deploy-trace-logging PROPERTIES PASS_REGULAR_EXPRESSION "Loglevel set to 0" LABELS "credentials")

Expand Down Expand Up @@ -357,17 +357,19 @@ if (BUILD_SOTA_TOOLS)
# Abort when given bogus fetch credentials.
add_test(NAME garage-deploy-missing-fetch-credentials
COMMAND ${PROJECT_SOURCE_DIR}/tests/sota_tools/test-garage-deploy-missing-fetch-credentials $<TARGET_FILE:garage-deploy>
${SOTA_PACKED_CREDENTIALS}
tests/test_data/credentials.zip
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR})

# Abort when given bogus push credentials.
add_test(NAME garage-deploy-missing-push-credentials
COMMAND ${PROJECT_SOURCE_DIR}/tests/sota_tools/test-garage-deploy-missing-push-credentials $<TARGET_FILE:garage-deploy>
${SOTA_PACKED_CREDENTIALS}
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR})
set_tests_properties(garage-deploy-missing-push-credentials PROPERTIES LABELS "credentials")

if(SOTA_PACKED_CREDENTIALS)
# Abort when given bogus push credentials.
# Garage-deploy checks that the fetch credentials are valid before looking
# at the push credentials, so this requires real SOTA_PACKED_CREDENTIALS
add_test(NAME garage-deploy-missing-push-credentials
COMMAND ${PROJECT_SOURCE_DIR}/tests/sota_tools/test-garage-deploy-missing-push-credentials $<TARGET_FILE:garage-deploy>
${SOTA_PACKED_CREDENTIALS}
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR})
set_tests_properties(garage-deploy-missing-push-credentials PROPERTIES LABELS "credentials")

# Use garage-sign to offline sign targets for destination repository.
# Remove local tuf repo generated by garage-sign after use.
add_test(NAME garage-deploy-offline-signing
Expand Down

0 comments on commit 819c82c

Please sign in to comment.