Skip to content

Commit 79f1bc9

Browse files
committed
mongodb perf testing
1 parent bd85ea0 commit 79f1bc9

2 files changed

Lines changed: 113 additions & 0 deletions

File tree

.github/workflows/perf_mongodb.yml

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
name: MongoDB support test
2+
on:
3+
push:
4+
branches: [ perf, "mongodb*", "*mongodb*" ]
5+
pull_request:
6+
branches: [ perf ]
7+
jobs:
8+
unit_test:
9+
runs-on: ubuntu-latest
10+
11+
# Configuration, for us to perform test against multiple version in the future
12+
strategy:
13+
matrix:
14+
mongodb-version: ['5.0']
15+
16+
# The test step
17+
steps:
18+
# Start the mongoDB
19+
- name: Start MongoDB
20+
uses: supercharge/mongodb-github-action@1.7.0
21+
with:
22+
mongodb-version: ${{ matrix.mongodb-version }}
23+
24+
# The usual checkout, and test
25+
- uses: actions/checkout@v1
26+
- name: Init submodules
27+
run: ./git-init-submodules.sh
28+
- name: Set up JDK 1.8
29+
uses: actions/setup-java@v1
30+
with:
31+
java-version: 1.8
32+
- name: Cache Gradle packages
33+
uses: actions/cache@v2
34+
with:
35+
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/build.gradle') }}
36+
path: |
37+
~/.gradle/caches
38+
~/.gradle/wrapper
39+
- name: Setup gradle binaries
40+
run: ./gradlew
41+
- name: Pull dependencies libs, and perform initial compile
42+
run: ./gradlew src
43+
# - name: Run unit tests
44+
# run: ./gradlew test -Ptest_mongodb
45+
- name: Run perf unit tests
46+
run: |
47+
./gradle-test-classpath.sh picoded.dstack.mongodb.MongoDB_DataObjectMap_perf
48+
- name: Run jacocoTestReport
49+
run: ./gradlew jacocoTestReport
50+
- name: Archive code coverage results
51+
uses: actions/upload-artifact@v2
52+
if: always()
53+
with:
54+
name: test-result-report
55+
path: |
56+
build/reports/**/*
57+
build/test-results/**/*
58+
build/jacoco/**/*
59+
- name: Upload code coverage to codecov
60+
uses: codecov/codecov-action@v2
61+
if: always()
62+
with:
63+
# flags: gradle-build # optional
64+
# directory: build/jacoco/
65+
verbose: true # optional (default = false)
66+
fail_ci_if_error: false
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
package picoded.dstack.mongodb;
2+
3+
import picoded.core.struct.*;
4+
import picoded.dstack.*;
5+
import picoded.dstack.struct.simple.*;
6+
7+
/**
8+
* ## Purpose
9+
* This class is meant to test the MongoDB_DataObjectMap implementation,
10+
* and ensure that it passes all the test layed out in StructSImple_DataObjectMap_test
11+
*
12+
*/
13+
public class MongoDB_DataObjectMap_perf extends StructSimple_DataObjectMap_perf {
14+
15+
// Hazelcast stack instance
16+
protected static volatile MongoDBStack instance = null;
17+
18+
// To override for implementation
19+
//-----------------------------------------------------
20+
21+
/// Impomentation constructor
22+
public DataObjectMap implementationConstructor() {
23+
24+
// Initialize server
25+
synchronized (MongoDB_DataObjectMap_test.class) {
26+
if (instance == null) {
27+
// The default config uses localhost, 27017
28+
GenericConvertMap<String, Object> mongodbConfig = new GenericConvertHashMap<>();
29+
mongodbConfig.put("host", DStackTestConfig.MONGODB_HOST());
30+
mongodbConfig.put("port", DStackTestConfig.MONGODB_PORT());
31+
32+
// Use a random DB name
33+
mongodbConfig.put("name", DStackTestConfig.randomTablePrefix());
34+
35+
GenericConvertMap<String, Object> stackConfig = new GenericConvertHashMap<>();
36+
stackConfig.put("name", "MongoDB_DataObjectMap_test");
37+
stackConfig.put("mongodb", mongodbConfig);
38+
39+
instance = new MongoDBStack(stackConfig);
40+
}
41+
}
42+
43+
// Load the DataObjectMap
44+
return instance.dataObjectMap(DStackTestConfig.randomTablePrefix());
45+
}
46+
47+
}

0 commit comments

Comments
 (0)