[libgda] ci: adding configuration for postgres service



commit 5bc689b8d0181c4d26e7651a48e077057e73a6a4
Author: Daniel Espinosa Ortiz <esodan gmail com>
Date:   Thu Dec 13 21:55:00 2018 -0600

    ci: adding configuration for postgres service

 .gitlab-ci.yml                                 | 5 ++++-
 meson.build                                    | 4 ++++
 meson_options.txt                              | 1 +
 tests/ddl/check-ddl-creator-postgresql.c       | 8 +++++++-
 tests/meta-store/check_meta_store_postgresql.c | 7 +++++--
 5 files changed, 21 insertions(+), 4 deletions(-)
---
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 3fc496030..d32b07dbb 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -11,6 +11,9 @@ stages:
      - build
 
 variables:
+  POSTGRES_DB: test
+  POSTGRES_USER: test
+  POSTGRES_PASSWORD: "test1"
   DEPENDENCIES: gcc gettext gtk-doc-tools make autoconf
                 meson ninja-build
                 libgtk-3-dev libxml2-dev gnome-common
@@ -115,4 +118,4 @@ pages:
   - mv doc/C/libgdaui/html public/C/libgdaui-6.0
   artifacts:
     paths:
-    - public
+    - public
\ No newline at end of file
diff --git a/meson.build b/meson.build
index d276dc420..19e823ce1 100644
--- a/meson.build
+++ b/meson.build
@@ -244,6 +244,10 @@ if get_option('enable-debug')
   c_args += '-DGDA_DEBUG'
 endif
 
+if get_option('enable-ci-environment')
+  c_args += '-DCI_ENVIRONMENT'
+endif
+
 add_global_arguments(c_args, language : 'c')
 
 # Files references by sqlite embedded and provider
diff --git a/meson_options.txt b/meson_options.txt
index 8395954de..1905c12b7 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -14,4 +14,5 @@ option('system-sqlite', type : 'boolean', value : true, description : 'Use SQLit
 option('with-examples', type : 'boolean', value : false, description : 'Compile examples [default=false')
 option('system-sqlcipher', type : 'boolean', value : true, description : 'Use SQLCipher installed on the 
system [default=false')
 option('enable-tools', type : 'boolean', value : false, description : 'Enable build GUI Tools')
+option('enable-ci-environment', type : 'boolean', value : false, description : 'Enable Continous Integration 
Environment test')
 
diff --git a/tests/ddl/check-ddl-creator-postgresql.c b/tests/ddl/check-ddl-creator-postgresql.c
index 79373c683..b861cb102 100644
--- a/tests/ddl/check-ddl-creator-postgresql.c
+++ b/tests/ddl/check-ddl-creator-postgresql.c
@@ -236,8 +236,14 @@ test_ddl_creator_start (CheckDdlObject *self,
 
   g_assert_nonnull (self->xmlfile);
 
+#ifdef CI_ENVIRONMENT
+  const gchar *cnc_string = "DB_NAME=test;HOST=postgres;USERNAME=test;PASSWORD=test1";
+#else
+  const gchar *cnc_string = "DB_NAME=test;HOST=localhost;USERNAME=test;PASSWORD=test1";
+#endif
+
   self->cnc = gda_connection_new_from_string("Postgresql",
-                                             "DB_NAME=test;HOST=localhost;USERNAME=test;PASSWORD=test1",
+                                             cnc_string,
                                              NULL,
                                              GDA_CONNECTION_OPTIONS_NONE,
                                              NULL);
diff --git a/tests/meta-store/check_meta_store_postgresql.c b/tests/meta-store/check_meta_store_postgresql.c
index 230739bd7..a154146dc 100644
--- a/tests/meta-store/check_meta_store_postgresql.c
+++ b/tests/meta-store/check_meta_store_postgresql.c
@@ -26,12 +26,15 @@ main(int argc, char ** argv)
 {
        GdaConnection *cnc;
        GdaMetaStore *store;
-       gchar *cnc_string;
        GError *error = NULL;
+#ifdef CI_ENVIRONMENT
+  const gchar *cnc_string = "DB_NAME=test;HOST=postgres;USERNAME=test;PASSWORD=test1";
+#else
+  const gchar *cnc_string = "DB_NAME=test;HOST=localhost;USERNAME=test;PASSWORD=test1";
+#endif
 
        gda_init ();
 
-       cnc_string = "DB_NAME=test;HOST=localhost;USERNAME=test;PASSWORD=test1";
        /* connection try */
        cnc = gda_connection_open_from_string ("PostgreSQL", cnc_string, NULL, GDA_CONNECTION_OPTIONS_NONE, 
&error);
        if (cnc == NULL) {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]