Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor : refactor the agent proxy test data #32240

1 change: 1 addition & 0 deletions test/e2e/agent/engine/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@
<directory>${project.basedir}/src/test/resources/docker/proxy/</directory>
<includes>
<include>Dockerfile</include>
<include>entrypoint/entrypoint.sh</include>
</includes>
</resource>
<resource>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
import org.testcontainers.containers.output.OutputFrame;
import org.testcontainers.shaded.org.awaitility.Awaitility;

import java.sql.SQLException;
import java.time.Duration;
import java.util.Collection;
import java.util.LinkedList;
Expand Down Expand Up @@ -115,11 +114,6 @@ private void createProxyEnvironment(final Optional<DockerITContainer> agentPlugi
containers.registerContainer(governanceContainer);
containers.registerContainer(proxyContainer);
containers.start();
try {
proxyRequestExecutor = new ProxyRequestExecutor(proxyContainer.getConnection());
proxyRequestExecutor.start();
} catch (final SQLException ignored) {
}
}

@SuppressWarnings("OptionalUsedAsFieldOrParameterType")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@ ARG APP_NAME
ENV IS_DOCKER true
ENV LOCAL_PATH /opt/shardingsphere-proxy

ADD entrypoint/entrypoint.sh /opt/entrypoint.sh
ADD ${APP_NAME}.tar.gz /opt
RUN chmod +x /opt/entrypoint.sh
RUN mv /opt/${APP_NAME} ${LOCAL_PATH} && mkdir -p ${LOCAL_PATH}/ext-lib && wget https://repo1.maven.org/maven2/mysql/mysql-connector-java/5.1.49/mysql-connector-java-5.1.49.jar -P ${LOCAL_PATH}/ext-lib
ENTRYPOINT ${LOCAL_PATH}/bin/start.sh -g
RUN apt update
RUN apt install default-mysql-client -y

ENTRYPOINT /opt/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/bin/bash
#
# 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.
#

nohup bash -c "/opt/shardingsphere-proxy/bin/start.sh -g" </dev/null &>/dev/null &
sleep 20

for ((i=1; i<=10; i++))
do mysql -uroot -h127.0.0.1 -proot -P3307 -e "USE sharding_db;INSERT INTO t_order (order_id, user_id, status) VALUES (${i}, ${i}, \"INSERT_TEST\");"
done
mysql -uroot -h127.0.0.1 -proot -P3307 -e "USE sharding_db;set autocommit=0;INSERT INTO t_order (order_id, user_id, status) VALUES (1000, 1000, \"ROLL_BACK\");rollback"
mysql -uroot -h127.0.0.1 -proot -P3307 -e "USE sharding_db;set autocommit=0;UPDATE t_order SET status = 1000 WHERE order_id =1000;commit;"
mysql -uroot -h127.0.0.1 -proot -P3307 -e "USE sharding_db;SELECT * FROM t_order;"
for ((i=1; i<=10; i++))
do mysql -uroot -h127.0.0.1 -proot -P3307 -e "USE sharding_db;DELETE FROM t_order WHERE order_id=${i};"
done
set +e
mysql -uroot -h127.0.0.1 -proot -P3307 -e "USE sharding_db;SELECT * FROM non_existent_table;"
set -e
Loading