[libgda: 1/2] Test: Fixing DB name conflict
- From: Daniel Espinosa Ortiz <despinosa src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libgda: 1/2] Test: Fixing DB name conflict
- Date: Tue, 10 Mar 2020 19:11:57 +0000 (UTC)
commit 88c4fe9b589da220a8d0ace673318b484ba59eb0
Author: Pavlo Solntsev <p sun fun gmail com>
Date: Sun Mar 8 23:13:34 2020 -0500
Test: Fixing DB name conflict
See https://gitlab.gnome.org/GNOME/libgda/issues/211 for details
tests/providers/prov-test-common.c | 15 +++++++++++++--
tests/test-cnc-utils.c | 3 +--
2 files changed, 14 insertions(+), 4 deletions(-)
---
diff --git a/tests/providers/prov-test-common.c b/tests/providers/prov-test-common.c
index 8810e43b2..f7b839e25 100644
--- a/tests/providers/prov-test-common.c
+++ b/tests/providers/prov-test-common.c
@@ -50,8 +50,19 @@ prov_test_common_setup (void)
#ifdef CHECK_EXTRA_INFO
g_print ("\n============= %s() =============\n", __FUNCTION__);
#endif
-
- cnc = test_cnc_setup_connection (pinfo->id, "testcheckdb", &error);
+ /* We will use a unique name for database for every test.
+ * The format of the database name is:
+ * testXXXXX where XXXXX is a string generated from the random int32 numbers
+ * that correspond to ASCII codes for characters a-z
+ */
+ GString *buffer = g_string_new ("test");
+
+ for (int i = 0; i < 5; ++i) {
+ gint32 character = g_random_int_range (97, 123);
+ buffer = g_string_append_c (buffer, character);
+ }
+ cnc = test_cnc_setup_connection (pinfo->id, buffer->str, &error);
+ g_string_free (buffer, TRUE);
if (!cnc) {
if (error) {
if (error->domain != TEST_ERROR) {
diff --git a/tests/test-cnc-utils.c b/tests/test-cnc-utils.c
index b9976e3ad..17bd4b084 100644
--- a/tests/test-cnc-utils.c
+++ b/tests/test-cnc-utils.c
@@ -129,8 +129,7 @@ test_cnc_open_connection (const gchar *provider, const gchar *dbname, GError **e
if (*(data.string->str) != 0)
g_string_append_c (data.string, ';');
- g_string_append_printf (data.string, "DB_NAME=%s",
- data.requested_db_name ? data.requested_db_name : dbname);
+ g_string_append_printf (data.string, "DB_NAME=%s", dbname);
g_print ("Open connection string: %s\n", data.string->str);
GString *auth_string = g_string_new ("");
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]