forked from sermant-io/Sermant
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
database write prohibition integration: mongodb, mysql
Signed-off-by: daizhenyu <[email protected]>
- Loading branch information
Showing
18 changed files
with
1,765 additions
and
20 deletions.
There are no files selected for viewing
38 changes: 38 additions & 0 deletions
38
.github/actions/common/database-write-prohibition/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,38 @@ | ||
name: "Common operations" | ||
description: "do something common for database-write-prohibition plugin test" | ||
runs: | ||
using: "composite" | ||
steps: | ||
- name: Set up JDK ${{ env.javaVersion }} | ||
uses: actions/setup-java@v3 | ||
with: | ||
java-version: ${{ env.javaVersion }} | ||
distribution: 'adopt' | ||
cache: maven | ||
- name: get zookeeper from cache | ||
uses: actions/cache@v3 | ||
with: | ||
path: apache-zookeeper-3.6.3-bin.tar.gz | ||
key: ${{ runner.os }}-apache-zookeeper-3.6.3 | ||
- name: run zookeeper | ||
shell: bash | ||
run: | | ||
tar -zxf apache-zookeeper-3.6.3-bin.tar.gz | ||
bash apache-zookeeper-3.6.3-bin/bin/zkServer.sh start apache-zookeeper-3.6.3-bin/conf/zoo_sample.cfg | ||
- name: cache dependencies | ||
uses: actions/cache@v3 | ||
with: | ||
path: ~/.m2/repository | ||
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} | ||
restore-keys: | | ||
${{ runner.os }}-maven- | ||
- name: cache agent | ||
uses: actions/cache@v3 | ||
with: | ||
path: sermant-agent-*/ | ||
key: ${{ runner.os }}-agent-${{ github.run_id }} | ||
- name: entry | ||
uses: ./.github/actions/common/entry | ||
with: | ||
log-dir: ./logs/database-write-prohibition/common | ||
key: ${{ runner.os }}-agent-${{ github.run_id }} |
95 changes: 95 additions & 0 deletions
95
.github/workflows/database_write_prohibition_integration_test.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,95 @@ | ||
name: database-write-prohibition integration test | ||
env: | ||
sermantVersion: 1.0.0 | ||
on: | ||
push: | ||
pull_request: | ||
branches: | ||
- '*' | ||
paths: | ||
- 'sermant-agentcore/**' | ||
- 'sermant-integration-tests/database-write-prohibition-test/**' | ||
- 'sermant-plugins/sermant-database-write-prohibition/**' | ||
- '.github/workflows/database_write_prohibition_integration_test.yml' | ||
- '.github/actions/common/database-write-prohibition/**' | ||
- '.github/actions/scenarios/database-write-prohibition/**' | ||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}-${{ github.head_ref }} | ||
cancel-in-progress: true | ||
jobs: | ||
download-midwares-and-cache: | ||
name: download midwares and cache | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: cache zookeeper | ||
uses: actions/cache@v3 | ||
with: | ||
path: apache-zookeeper-3.6.3-bin.tar.gz | ||
key: ${{ runner.os }}-apache-zookeeper-3.6.3 | ||
restore-keys: | | ||
${{ runner.os }}-apache-zookeeper-3.6.3 | ||
- name: download zookeeper | ||
run: | | ||
export ROOT_PATH=$(pwd) | ||
bash ./sermant-integration-tests/scripts/tryDownloadMidware.sh zk | ||
build-agent-and-cache: | ||
name: build agent and cache | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Set up JDK 8 | ||
uses: actions/setup-java@v3 | ||
with: | ||
java-version: '8' | ||
distribution: 'adopt' | ||
cache: maven | ||
- name: cache agent | ||
uses: actions/cache@v3 | ||
with: | ||
path: sermant-agent-*/ | ||
key: ${{ runner.os }}-agent-${{ github.run_id }} | ||
- name: package agent | ||
run: | | ||
sed -i '/sermant-backend/d' pom.xml | ||
sed -i '/sermant-integration-tests/d' pom.xml | ||
sed -i '/sermant-injector/d' pom.xml | ||
mvn package -DskipTests -Ptest --file pom.xml | ||
test-for-database-write-prohibition-mongodb: | ||
name: Test for database-write-prohibition mongodb | ||
runs-on: ubuntu-latest | ||
needs: [build-agent-and-cache, download-midwares-and-cache] | ||
strategy: | ||
matrix: | ||
include: | ||
fail-fast: false | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 100 | ||
- name: set java version to environment | ||
run: | | ||
echo "javaVersion=8" >> $GITHUB_ENV | ||
- name: common operations | ||
uses: ./.github/actions/common/database-write-prohibition | ||
- name: database-write-prohibition-mongodb test for mongodbVersion=${{ matrix.mongodbVersion }} | ||
uses: ./.github/actions/scenarios/database-write-prohibition/mongodb | ||
test-for-database-write-prohibition-mysql: | ||
name: Test for database-write-prohibition mysql | ||
runs-on: ubuntu-latest | ||
needs: [build-agent-and-cache, download-midwares-and-cache] | ||
strategy: | ||
matrix: | ||
include: | ||
fail-fast: false | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 100 | ||
- name: set java version to environment | ||
run: | | ||
echo "javaVersion=8" >> $GITHUB_ENV | ||
- name: common operations | ||
uses: ./.github/actions/common/database-write-prohibition | ||
- name: database-write-prohibition-mysql test for mysqlVersion=${{ matrix.mysqlVersion }} | ||
uses: ./.github/actions/scenarios/database-write-prohibition/mysql |
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
48 changes: 48 additions & 0 deletions
48
...a/com/huaweicloud/sermant/database/prohibition/integration/constant/DatabaseConstant.java
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,48 @@ | ||
/* | ||
* Copyright (C) 2024-2024 Huawei Technologies Co., Ltd. All rights reserved. | ||
* | ||
* Licensed 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. | ||
*/ | ||
|
||
package com.huaweicloud.sermant.database.prohibition.integration.constant; | ||
|
||
/** | ||
* common constant | ||
* | ||
* @author daizhenyu | ||
* @since 2024-03-11 | ||
**/ | ||
public class DatabaseConstant { | ||
/** | ||
* fail to execute database write operation status code | ||
*/ | ||
public static final String OPERATION_FAIL_CODE = "100"; | ||
|
||
/** | ||
* succeed to execute database write operation status code | ||
*/ | ||
public static final String OPERATION_SUCCEED_CODE = "101"; | ||
|
||
/** | ||
* database table data count | ||
*/ | ||
public static final String DATA_COUNT = "1"; | ||
|
||
/** | ||
* line separator | ||
*/ | ||
public static final String LINE_SEPARATOR = System.getProperty("line.separator"); | ||
|
||
private DatabaseConstant() { | ||
} | ||
} |
Oops, something went wrong.