[libgda] mysql: added test as provider
- From: Daniel Espinosa Ortiz <despinosa src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libgda] mysql: added test as provider
- Date: Wed, 16 Jan 2019 18:02:30 +0000 (UTC)
commit 92887f8ad76dcbe1adebd574d524aa675c96bccc
Author: Daniel Espinosa Ortiz <esodan gmail com>
Date: Wed Jan 16 12:01:50 2019 -0600
mysql: added test as provider
.gitlab-ci.yml | 5 ++---
providers/reuseable/mysql/gda-mysql-meta.c | 7 ++++++-
tests/providers/check_mysql.c | 22 ++++++++++++++++++++--
tests/providers/meson.build | 27 ++++++++++++++++++++++++++-
4 files changed, 54 insertions(+), 7 deletions(-)
---
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 71540861f..ce5007b78 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -52,9 +52,8 @@ variables:
POSTGRESQL_DBCREATE_PARAMS: "HOST=$POSTGRES_HOST;ADM_LOGIN=$POSTGRES_USER;ADM_PASSWORD=$POSTGRES_PASSWORD"
POSTGRESQL_CNC_PARAMS: "HOST=$POSTGRES_HOST;USERNAME=$POSTGRES_USER;PASSWORD=$POSTGRES_PASSWORD"
POSTGRESQL_META_CNC:
"DB_NAME=$POSTGRES_DB;HOST=$POSTGRES_HOST;USERNAME=$POSTGRES_USER;PASSWORD=$POSTGRES_PASSWORD"
-# MYSQL_DBCREATE_PARAMS: "HOST=$MYSQL_HOST;ADM_LOGIN=$MYSQL_USER;ADM_PASSWORD=$MYSQL_PASSWORD"
-# MYSQL_CNC_PARAMS: "HOST=$MYSQL_HOST;USERNAME=$MYSQL_USER;PASSWORD=$MYSQL_PASSWORD"
-# MYSQL_META_CNC: "DB_NAME=$MYSQL_DB;HOST=$MYSQL_HOST;USERNAME=$MYSQL_USER;PASSWORD=$MYSQL_PASSWORD"
+ MYSQL_CNC_PARAMS: "DB_NAME=$MYSQL_DB;HOST=$MYSQL_HOST;USERNAME=$MYSQL_USER;PASSWORD=$MYSQL_PASSWORD"
+ MYSQL_META_CNC: "DB_NAME=$MYSQL_DB;HOST=$MYSQL_HOST;USERNAME=$MYSQL_USER;PASSWORD=$MYSQL_PASSWORD"
before_script:
- apt update && apt -y install $DEPENDENCIES
diff --git a/providers/reuseable/mysql/gda-mysql-meta.c b/providers/reuseable/mysql/gda-mysql-meta.c
index 0a95d0ad6..8d1fb2996 100644
--- a/providers/reuseable/mysql/gda-mysql-meta.c
+++ b/providers/reuseable/mysql/gda-mysql-meta.c
@@ -329,6 +329,10 @@ _gda_mysql_meta__btypes (G_GNUC_UNUSED GdaServerProvider *prov,
GdaMetaContext *context,
GError **error)
{
+#if MYSQL8
+ // No supported
+ return TRUE;
+#else
typedef struct
{
gchar *tname;
@@ -426,7 +430,8 @@ _gda_mysql_meta__btypes (G_GNUC_UNUSED GdaServerProvider *prov,
g_object_unref (G_OBJECT(model));
}
- return retval;
+ return retval;
+#endif
}
gboolean
diff --git a/tests/providers/check_mysql.c b/tests/providers/check_mysql.c
index 09336044d..16a9f5ec4 100644
--- a/tests/providers/check_mysql.c
+++ b/tests/providers/check_mysql.c
@@ -29,6 +29,18 @@ int
main (int argc, char **argv)
{
int number_failed = 0;
+ gchar **env;
+ const gchar *cnc_string;
+ GError *error = NULL;
+
+ env = g_get_environ ();
+ cnc_string = g_environ_getenv (env, "MYSQL_CNC_PARAMS");
+ if (cnc_string == NULL) {
+ g_message ("No enviroment variable MYSQL_CNC_PARAMS was set. No PostgreSQL provider tests
will be performed."
+ "Set this environment variable in order to get access to your server. Example:
export
MYSQL_CNC_PARAMS=\"DB_NAME=$MYSQL_DB;HOST=$MYSQL_HOST;USERNAME=$MYSQL_USER;PASSWORD=$MYSQL_PASSWORD\"");
+ g_strfreev (env);
+ return EXIT_SUCCESS;
+ }
gda_init ();
@@ -38,13 +50,19 @@ main (int argc, char **argv)
return EXIT_SUCCESS;
}
g_print ("Provider now tested: %s\n", pinfo->id);
-
- number_failed = prov_test_common_setup ();
+ cnc = gda_connection_open_from_string (pinfo->id, cnc_string, NULL, GDA_CONNECTION_OPTIONS_NONE,
&error);
+ if (cnc == NULL) {
+ g_warning ("Error opening connection: %s",
+ error && error->message ? error->message : "No error was set");
+ return EXIT_FAILURE;
+ }
if (cnc) {
number_failed += prov_test_common_check_timestamp ();
number_failed += prov_test_common_check_meta_full ();
number_failed += prov_test_common_check_meta_partial ();
+ number_failed += prov_test_common_check_meta_partial2 ();
+ number_failed += prov_test_common_check_meta_partial3 ();
number_failed += prov_test_common_clean ();
}
diff --git a/tests/providers/meson.build b/tests/providers/meson.build
index 95e9404c8..e3ef7afb7 100644
--- a/tests/providers/meson.build
+++ b/tests/providers/meson.build
@@ -133,4 +133,29 @@ test('ProviderMetaPartialUpdate2PostgreSQL', tchkpg_mu2,
)
endif
-
\ No newline at end of file
+
+if mysql_dep.found ()
+tchkmysql = executable('check_mysql',
+ ['check_mysql.c']+providers_common_sources+common_sources+tests_sources,
+ c_args: [
+ '-include',
+ meson.build_root() + '/config.h',
+ '-DCHECK_SQL_FILES="'+meson.source_root()+'"',
+ ],
+ link_with: libgda,
+ dependencies: [
+ libgda_dep,
+ inc_rooth_dep,
+ inc_sqliteh_dep,
+ inc_testsh_dep
+ ],
+ install: false
+ )
+test('ProviderMySQL', tchkmysql,
+ timeout: 300,
+ env: [
+ 'GDA_TOP_SRC_DIR='+meson.source_root(),
+ 'GDA_TOP_BUILD_DIR='+meson.build_root()
+ ]
+ )
+endif
\ No newline at end of file
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]