You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by zh...@apache.org on 2023/05/10 09:54:07 UTC
[shardingsphere] branch master updated: Fix pipeline ci failed when using mysql:8 (#25549)
This is an automated email from the ASF dual-hosted git repository.
zhonghongsheng pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shardingsphere.git
The following commit(s) were added to refs/heads/master by this push:
new 3ff5bfd32ff Fix pipeline ci failed when using mysql:8 (#25549)
3ff5bfd32ff is described below
commit 3ff5bfd32ff74f2deb1a96eacb0dd3b021bbab33
Author: Xinze Guo <10...@users.noreply.github.com>
AuthorDate: Wed May 10 17:53:58 2023 +0800
Fix pipeline ci failed when using mysql:8 (#25549)
* Fix pipeline ci failed when using mysql:8
* Improve mouted resources
---
.../container/compose/DockerContainerComposer.java | 7 ++++++-
.../src/test/resources/env/mysql/mysql8/02-initdb.sql | 18 ++++++++++++++++++
2 files changed, 24 insertions(+), 1 deletion(-)
diff --git a/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/data/pipeline/framework/container/compose/DockerContainerComposer.java b/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/data/pipeline/framework/container/compose/DockerContainerComposer.java
index 962e23b3272..97f64ac5aae 100644
--- a/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/data/pipeline/framework/container/compose/DockerContainerComposer.java
+++ b/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/data/pipeline/framework/container/compose/DockerContainerComposer.java
@@ -39,6 +39,7 @@ import org.apache.shardingsphere.test.e2e.env.runtime.DataSourceEnvironment;
import java.security.InvalidParameterException;
import java.util.Collections;
+import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
@@ -68,7 +69,11 @@ public final class DockerContainerComposer extends BaseContainerComposer {
StorageContainerConfiguration storageContainerConfig;
if (DatabaseTypeUtils.isMySQL(databaseType)) {
int majorVersion = new DockerImageVersion(storageContainerImage).getMajorVersion();
- Map<String, String> mountedResources = Collections.singletonMap(String.format("/env/mysql/mysql%s/my.cnf", majorVersion), MySQLContainer.MYSQL_CONF_IN_CONTAINER);
+ Map<String, String> mountedResources = new HashMap<>();
+ mountedResources.put(String.format("/env/mysql/mysql%s/my.cnf", majorVersion), MySQLContainer.MYSQL_CONF_IN_CONTAINER);
+ if (majorVersion > 5) {
+ mountedResources.put("/env/mysql/mysql8/02-initdb.sql", "/docker-entrypoint-initdb.d/02-initdb.sql");
+ }
storageContainerConfig = MySQLContainerConfigurationFactory.newInstance(null, null, mountedResources);
} else {
storageContainerConfig = StorageContainerConfigurationFactory.newInstance(databaseType);
diff --git a/test/e2e/operation/pipeline/src/test/resources/env/mysql/mysql8/02-initdb.sql b/test/e2e/operation/pipeline/src/test/resources/env/mysql/mysql8/02-initdb.sql
new file mode 100644
index 00000000000..8322374570d
--- /dev/null
+++ b/test/e2e/operation/pipeline/src/test/resources/env/mysql/mysql8/02-initdb.sql
@@ -0,0 +1,18 @@
+--
+-- Licensed to the Apache Software Foundation (ASF) under one or more
+-- contributor license agreements. See the NOTICE file distributed with
+-- this work for additional information regarding copyright ownership.
+-- The ASF licenses this file to You under the Apache License, Version 2.0
+-- (the "License"); you may not use this file except in compliance with
+-- the License. You may obtain a copy of the License at
+--
+-- http://www.apache.org/licenses/LICENSE-2.0
+--
+-- Unless required by applicable law or agreed to in writing, software
+-- distributed under the License is distributed on an "AS IS" BASIS,
+-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+-- See the License for the specific language governing permissions and
+-- limitations under the License.
+--
+
+GRANT XA_RECOVER_ADMIN ON *.* TO `test_user`@`%`;