-
Notifications
You must be signed in to change notification settings - Fork 172
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add test demo for database write prohibition plugin
Signed-off-by: hanbingleixue <[email protected]>
- Loading branch information
1 parent
3c1ae15
commit 6d4e321
Showing
24 changed files
with
1,865 additions
and
127 deletions.
There are no files selected for viewing
74 changes: 74 additions & 0 deletions
74
.github/actions/scenarios/database-write-prohibition/opengauss/action.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
name: "Opengauss Database Write Prohibition Plugin Test" | ||
description: "Auto test for opengauss database write prohibition" | ||
runs: | ||
using: composite | ||
steps: | ||
- name: entry | ||
uses: ./.github/actions/common/entry | ||
with: | ||
log-dir: ./logs/database-write-prohibition/opengauss | ||
- name: install opengauss | ||
shell: bash | ||
run: | | ||
sudo apt-get update | ||
sudo apt-get install -y apt-transport-https ca-certificates curl gnupg-agent software-properties-common | ||
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - | ||
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | ||
sudo apt-get update | ||
sudo apt-get install -y docker-ce docker-ce-cli containerd.io | ||
docker run --name opengauss -d --privileged=true -e GS_PASSWORD=${{ env.datasourcePassword }} -p 5432:5432 enmotech/opengauss:3.0.0 | ||
sleep 20s | ||
- name: package demos | ||
shell: bash | ||
run: | | ||
mvn package -Ddatabase.version=${{ matrix.opengaussVersion }} -Ddatabase.groupId=org.opengauss -Ddatabase.artifactId=opengauss-jdbc \ | ||
-DskipTests -Ppostgresql-opengauss-test --file sermant-integration-tests/database-write-prohibition-test/pom.xml | ||
- name: start opengauss(org.opengauss) demo | ||
if: matrix.opengaussVersion == '3.0.0' || matrix.opengaussVersion == '3.0.5-og' || matrix.opengaussVersion == '3.1.0-og' || matrix.opengaussVersion =='3.1.1-og' | ||
shell: bash | ||
env: | ||
SPRING_DATASOURCE_DRIVER_CLASS_NAME: org.opengauss.Driver | ||
SPRING_DATASOURCE_URL: jdbc:opengauss://127.0.0.1:5432/postgres?useUnicode=true&useSSL=false&characterEncoding=utf8&serverTimezone=GMT%2B8&allowPublicKeyRetrieval=true | ||
SPRING_DATASOURCE_USERNAME: gaussdb | ||
SPRING_DATASOURCE_PASSWORD: ${{ env.datasourcePassword }} | ||
run: | | ||
nohup java -javaagent:sermant-agent-${{ env.sermantVersion }}/agent/sermant-agent.jar -jar \ | ||
-Dsermant_log_dir=${{ env.logDir }}/opengauss \ | ||
sermant-integration-tests/database-write-prohibition-test/postgresql-opengauss-demo/target/postgresql-opengauss-demo.jar > ${{ env.logDir }}/opengauss.log 2>&1 & | ||
- name: start opengauss(org.postgresql) demo | ||
if: matrix.opengaussVersion == '3.1.0' || matrix.opengaussVersion =='3.1.1' || matrix.opengaussVersion == '3.0.5' | ||
shell: bash | ||
env: | ||
SPRING_DATASOURCE_DRIVER_CLASS_NAME: org.postgresql.Driver | ||
SPRING_DATASOURCE_URL: jdbc:postgresql://127.0.0.1:5432/postgres?useUnicode=true&useSSL=false&characterEncoding=utf8&serverTimezone=GMT%2B8&allowPublicKeyRetrieval=true | ||
SPRING_DATASOURCE_USERNAME: gaussdb | ||
SPRING_DATASOURCE_PASSWORD: ${{ env.datasourcePassword }} | ||
run: | | ||
nohup java -javaagent:sermant-agent-${{ env.sermantVersion }}/agent/sermant-agent.jar -jar \ | ||
-Dsermant_log_dir=${{ env.logDir }}/opengauss \ | ||
sermant-integration-tests/database-write-prohibition-test/postgresql-opengauss-demo/target/postgresql-opengauss-demo.jar > ${{ env.logDir }}/opengauss.log 2>&1 & | ||
- name: waiting for services start | ||
shell: bash | ||
run: | | ||
ps -ef | grep java | ||
bash ./sermant-integration-tests/scripts/checkService.sh http://127.0.0.1:8081/checkStatus 120 | ||
- name: test opengauss | ||
shell: bash | ||
run: | | ||
mvn test -Ddatabase.prohibition.integration.test.type=POSTGRESQL_OPENGAUSS --file \ | ||
sermant-integration-tests/database-write-prohibition-test/database-write-prohibition-integration-test/pom.xml | ||
- name: exit | ||
if: always() | ||
uses: ./.github/actions/common/exit | ||
with: | ||
processor-keyword: postgresql | ||
- name: if failure then upload error log | ||
uses: actions/upload-artifact@v3 | ||
if: ${{ failure() || cancelled() }} | ||
with: | ||
name: (${{ github.job }})-database-write-prohibition-opengauss-${{ matrix.opengaussVersion }}-logs | ||
path: | | ||
./*.log | ||
./logs/** | ||
if-no-files-found: warn | ||
retention-days: 2 |
66 changes: 66 additions & 0 deletions
66
.github/actions/scenarios/database-write-prohibition/postgresql/action.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
name: "Postgresql Database Write Prohibition Plugin Test" | ||
description: "Auto test for postgresql database write prohibition" | ||
runs: | ||
using: composite | ||
steps: | ||
- name: entry | ||
uses: ./.github/actions/common/entry | ||
with: | ||
log-dir: ./logs/database-write-prohibition/postgresql | ||
- name: install postgresql | ||
shell: bash | ||
run: | | ||
curl -fsSL https://www.postgresql.org/media/keys/ACCC4CF8.asc|sudo gpg --dearmor -o /etc/apt/trusted.gpg.d/postgresql.gpg | ||
echo "deb http://apt.postgresql.org/pub/repos/apt/ `lsb_release -cs`-pgdg main" |sudo tee /etc/apt/sources.list.d/pgdg.list | ||
sudo apt update | ||
sudo apt install postgresql-14 -y | ||
sudo service postgresql start | ||
sudo service postgresql status | ||
sudo -u postgres psql -c "CREATE DATABASE test;" | ||
sudo chmod -R 777 /etc/postgresql/14/main/ | ||
sudo sed -i 's/scram-sha-256/trust/g' /etc/postgresql/14/main/pg_hba.conf | ||
sudo sed -i 's/peer/trust/g' /etc/postgresql/14/main/pg_hba.conf | ||
sudo echo "host all all all md5" >> /etc/postgresql/14/main/pg_hba.conf | ||
sudo sed -i 's/#password_encryption = scram-sha-256/password_encryption = md5/g' /etc/postgresql/14/main/postgresql.conf | ||
sudo -u postgres psql -c "SELECT pg_reload_conf();set password_encryption = 'md5';show password_encryption;ALTER USER postgres WITH PASSWORD '${{ env.datasourcePassword }}';" | ||
- name: package demos | ||
shell: bash | ||
run: | | ||
mvn package -Ddatabase.version=${{ matrix.postgresqlVersion }} -Ddatabase.groupId=org.postgresql -Ddatabase.artifactId=postgresql \ | ||
-DskipTests -Ppostgresql-opengauss-test --file sermant-integration-tests/database-write-prohibition-test/pom.xml | ||
- name: start postgresql demo | ||
shell: bash | ||
env: | ||
SPRING_DATASOURCE_DRIVER_CLASS_NAME: org.postgresql.Driver | ||
SPRING_DATASOURCE_URL: jdbc:postgresql://127.0.0.1:5432/test?useUnicode=true&useSSL=false&characterEncoding=utf8&serverTimezone=GMT%2B8&allowPublicKeyRetrieval=true | ||
SPRING_DATASOURCE_USERNAME: postgres | ||
SPRING_DATASOURCE_PASSWORD: ${{ env.datasourcePassword }} | ||
run: | | ||
nohup java -javaagent:sermant-agent-${{ env.sermantVersion }}/agent/sermant-agent.jar -jar \ | ||
-Dsermant_log_dir=${{ env.logDir }}/postgresql \ | ||
sermant-integration-tests/database-write-prohibition-test/postgresql-opengauss-demo/target/postgresql-opengauss-demo.jar > ${{ env.logDir }}/postgresql.log 2>&1 & | ||
- name: waiting for services start | ||
shell: bash | ||
run: | | ||
ps -ef | grep java | ||
bash ./sermant-integration-tests/scripts/checkService.sh http://127.0.0.1:8081/checkStatus 120 | ||
- name: test postgresql | ||
shell: bash | ||
run: | | ||
mvn test -Ddatabase.prohibition.integration.test.type=POSTGRESQL_OPENGAUSS --file \ | ||
sermant-integration-tests/database-write-prohibition-test/database-write-prohibition-integration-test/pom.xml | ||
- name: exit | ||
if: always() | ||
uses: ./.github/actions/common/exit | ||
with: | ||
processor-keyword: postgresql | ||
- name: if failure then upload error log | ||
uses: actions/upload-artifact@v3 | ||
if: ${{ failure() || cancelled() }} | ||
with: | ||
name: (${{ github.job }})-database-write-prohibition-postgresql-${{ matrix.postgresqlVersion }}-logs | ||
path: | | ||
./*.log | ||
./logs/** | ||
if-no-files-found: warn | ||
retention-days: 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.