[libgda: 4/6] Test: Resolving merge conflic
- From: Pavlo Solntsev <psolntsev src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libgda: 4/6] Test: Resolving merge conflic
- Date: Tue, 1 Sep 2020 02:56:25 +0000 (UTC)
commit 889bae55ced8eedc7890787f57a4984164d2058c
Author: Pavlo Solntsev <p sun fun gmail com>
Date: Mon Aug 17 23:23:08 2020 -0500
Test: Resolving merge conflic
tests/db/check-db-catalog-postgresql.c | 15 ++++++++++++++-
tests/db/meson.build | 5 ++++-
tests/meson.build | 9 ++++++++-
tests/test-server-operation-postgresql.c | 23 +++++++++++++++++++++--
4 files changed, 47 insertions(+), 5 deletions(-)
---
diff --git a/tests/db/check-db-catalog-postgresql.c b/tests/db/check-db-catalog-postgresql.c
index 0e46b1550..5b8e9395c 100644
--- a/tests/db/check-db-catalog-postgresql.c
+++ b/tests/db/check-db-catalog-postgresql.c
@@ -23,12 +23,15 @@
#include <glib/gi18n.h>
#include <locale.h>
#include <libgda/libgda.h>
+#include "../test-cnc-utils.h"
typedef struct {
GdaDbCatalog *catalog;
GdaConnection *cnc;
gboolean started_db;
gboolean cont;
+ gchar *dbname;
+ GdaQuarkList *quark_list;
} CheckDbObject;
@@ -249,6 +252,13 @@ test_db_catalog_start (CheckDbObject *self,
self->cont = FALSE;
GError *error = NULL;
+ CreateDBObject *crdbobj = test_create_database ("PostgreSQL");
+
+ g_assert_nonnull (crdbobj);
+
+ self->dbname = crdbobj->dbname;
+ self->quark_list = crdbobj->quark_list;
+
gchar **env = g_get_environ ();
const gchar *cnc_string = g_environ_getenv (env, "POSTGRESQL_META_CNC");
@@ -260,8 +270,11 @@ test_db_catalog_start (CheckDbObject *self,
g_message ("Connecting using: %s", cnc_string);
+ GString *new_cnc_string = g_string_new (cnc_string);
+ g_string_append_printf (new_cnc_string, ";DB_NAME=%s", self->dbname);
+
self->cnc = gda_connection_new_from_string("PostgreSQL",
- cnc_string,
+ new_cnc_string->str,
NULL,
GDA_CONNECTION_OPTIONS_NONE,
NULL);
diff --git a/tests/db/meson.build b/tests/db/meson.build
index 7a44dd65f..639887559 100644
--- a/tests/db/meson.build
+++ b/tests/db/meson.build
@@ -150,7 +150,10 @@ test('dbcreate', dbcreate,
)
db_catalog_pg_sources = files([
- 'check-db-catalog-postgresql.c'
+ 'check-db-catalog-postgresql.c',
+ '../test-cnc-utils.c',
+ '../test-errors.c',
+ '../raw-ddl-creator.c'
])
tcpg = executable('check-db-catalog-postgresql',
diff --git a/tests/meson.build b/tests/meson.build
index 126b2ba59..6afb28dfa 100644
--- a/tests/meson.build
+++ b/tests/meson.build
@@ -226,7 +226,14 @@ test('SqlRenderer', tsqlr,
)
tsop = executable('test-server-operation-postgresql',
- ['test-server-operation-postgresql.c'] ,
+ ['test-server-operation-postgresql.c',
+ 'test-cnc-utils.h',
+ 'test-cnc-utils.c',
+ 'test-errors.h',
+ 'test-errors.c',
+ 'raw-ddl-creator.h',
+ 'raw-ddl-creator.c'
+ ] ,
c_args: [
'-include',
gda_top_build + '/config.h',
diff --git a/tests/test-server-operation-postgresql.c b/tests/test-server-operation-postgresql.c
index 56bb5c01c..37796c4be 100644
--- a/tests/test-server-operation-postgresql.c
+++ b/tests/test-server-operation-postgresql.c
@@ -38,6 +38,7 @@
#include <glib/gi18n.h>
#include <locale.h>
#include <libgda/libgda.h>
+#include "test-cnc-utils.h"
#define PROVIDER_NAME "PostgreSQL"
@@ -46,14 +47,26 @@
typedef struct
{
GdaConnection *cnc;
+ GdaServerProvider *provider;
+ gchar *dbname;
+ GdaQuarkList *quark_list;
} TestObjectFixture;
static void
test_server_operation_start (TestObjectFixture *fixture,
G_GNUC_UNUSED gconstpointer user_data)
{
+ GError *error = NULL;
+
fixture->cnc = NULL;
+ CreateDBObject *crdbobj = test_create_database (PROVIDER_NAME);
+
+ g_assert_nonnull (crdbobj);
+
+ fixture->dbname = crdbobj->dbname;
+ fixture->quark_list = crdbobj->quark_list;
+
const gchar *db_string = g_getenv("POSTGRESQL_CNC_PARAMS");
if (!db_string)
@@ -64,14 +77,17 @@ test_server_operation_start (TestObjectFixture *fixture,
return;
}
- GError *error = NULL;
+ GString *new_cnc_string = g_string_new (db_string);
+ g_string_append_printf (new_cnc_string, ";DB_NAME=%s", fixture->dbname);
fixture->cnc = gda_connection_open_from_string (PROVIDER_NAME,
- db_string,
+ new_cnc_string->str,
NULL,
GDA_CONNECTION_OPTIONS_NONE,
&error);
+ g_string_free (new_cnc_string, TRUE);
+
if (!fixture->cnc)
GDA_PGSQL_ERROR_HANDLE (error);
@@ -90,6 +106,9 @@ test_server_operation_finish (TestObjectFixture *fixture,
gboolean res = gda_connection_close (fixture->cnc, NULL);
g_assert_true (res);
+
+ gda_quark_list_free (fixture->quark_list);
+ g_free (fixture->dbname);
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]