summaryrefslogtreecommitdiffstats
path: root/tests/testgitstorage.cpp
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2019-12-31 17:08:05 -0800
committerGravatar Dirk Hohndel <dirk@hohndel.org>2020-01-01 15:11:20 -0800
commitf87275b80450aa2590c013be13f5f1f2a93f3909 (patch)
treee7a5557ae273f907eebc1db90a58c3531d92dde4 /tests/testgitstorage.cpp
parent66ce324ec545a5ef90133fd98e5934485a13e2f9 (diff)
downloadsubsurface-f87275b80450aa2590c013be13f5f1f2a93f3909.tar.gz
tests: allow overwriting cloud account
TestGitStorage is used in all test runs, which results in occasional errors because two test runs step on each other. This allows us to use different accounts in different runs. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'tests/testgitstorage.cpp')
-rw-r--r--tests/testgitstorage.cpp14
1 files changed, 12 insertions, 2 deletions
diff --git a/tests/testgitstorage.cpp b/tests/testgitstorage.cpp
index 899e33a3e..b84892a57 100644
--- a/tests/testgitstorage.cpp
+++ b/tests/testgitstorage.cpp
@@ -20,7 +20,7 @@
// this is a local helper function in git-access.c
extern "C" char *get_local_dir(const char *remote, const char *branch);
-QString email("ssrftest@hohndel.org");
+QString email;
QString gitUrl;
QString cloudTestRepo;
QString localCacheDir;
@@ -40,13 +40,23 @@ void TestGitStorage::initTestCase()
qPrefCloudStorage::load();
// setup our cloud test repo / credentials
+ // allow the caller to overwrite the cloud account we use; this way we
+ // can prevent the GitHub actions running tests in parallel from stepping
+ // on each other. Of course that email needs to exist as cloud storage account
+ // and have the given password
+ email = qgetenv("SSRF_USER_EMAIL");
+ QString password = qgetenv("SSRF_USER_PASSWORD");
+ if (email.isEmpty())
+ email = "ssrftest@hohndel.org";
+ if (password.isEmpty())
+ password = "geheim";
gitUrl = prefs.cloud_base_url;
if (gitUrl.right(1) != "/")
gitUrl += "/";
gitUrl += "git";
prefs.cloud_git_url = copy_qstring(gitUrl);
prefs.cloud_storage_email_encoded = copy_qstring(email);
- prefs.cloud_storage_password = strdup("geheim");
+ prefs.cloud_storage_password = copy_qstring(password);
gitUrl += "/" + email;
cloudTestRepo = gitUrl + QStringLiteral("[%1]").arg(email);
localCacheDir = get_local_dir(qPrintable(gitUrl), qPrintable(email));