Skip to content

Commit 4b98682

Browse files
authored
Merge pull request #182 from splunk/DVPL-9535
Merging the PR on approval
2 parents 631a6c3 + 2a1e3a4 commit 4b98682

File tree

5 files changed

+680
-606
lines changed

5 files changed

+680
-606
lines changed

.github/workflows/test.yml

Lines changed: 75 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -1,75 +1,75 @@
1-
name: Java CI with Maven
2-
3-
on:
4-
[push, pull_request]
5-
6-
jobs:
7-
unit-test:
8-
strategy:
9-
matrix:
10-
java-version:
11-
- 1.8
12-
- 11
13-
os:
14-
- ubuntu-latest
15-
- windows-latest
16-
- macos-latest
17-
runs-on: ${{ matrix.os }}
18-
steps:
19-
- uses: actions/checkout@v2
20-
- name: Set up JDK
21-
uses: actions/setup-java@v1
22-
with:
23-
java-version: ${{ matrix.java-version }}
24-
- name: Cache local Maven repository
25-
uses: actions/cache@v2
26-
with:
27-
path: ~/.m2/repository
28-
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
29-
restore-keys: |
30-
${{ runner.os }}-maven-
31-
- name: Unit Test
32-
run: mvn -P Unittest -B verify --file pom.xml
33-
34-
acceptance-test:
35-
needs: unit-test
36-
strategy:
37-
matrix:
38-
splunk-version:
39-
- 8.1
40-
- 7.3
41-
runs-on: ubuntu-latest
42-
container: maven:3-jdk-8
43-
44-
services:
45-
splunk:
46-
image: splunk/splunk:${{matrix.splunk-version}}
47-
env:
48-
SPLUNK_START_ARGS: --accept-license
49-
SPLUNK_PASSWORD: test_password
50-
ports:
51-
- 8089
52-
- 8088
53-
- 5555
54-
- 15000
55-
- 10667
56-
- 10668/udp
57-
58-
steps:
59-
- uses: actions/checkout@v2
60-
- name: Set up JDK
61-
uses: actions/setup-java@v1
62-
with:
63-
java-version: 1.8
64-
- name: Cache local Maven repository
65-
uses: actions/cache@v2
66-
with:
67-
path: ~/.m2/repository
68-
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
69-
restore-keys: |
70-
${{ runner.os }}-maven-
71-
- name: Acceptance Test
72-
run: mvn -P AcceptanceTest -B verify --file pom.xml
73-
env:
74-
SPLUNK_PASSWORD: test_password
75-
SPLUNK_HOST: splunk
1+
name: Java CI with Maven
2+
3+
on:
4+
[push, pull_request]
5+
6+
jobs:
7+
unit-test:
8+
strategy:
9+
matrix:
10+
java-version:
11+
- 1.8
12+
- 11
13+
os:
14+
- ubuntu-latest
15+
- windows-latest
16+
- macos-latest
17+
runs-on: ${{ matrix.os }}
18+
steps:
19+
- uses: actions/checkout@v2
20+
- name: Set up JDK
21+
uses: actions/setup-java@v1
22+
with:
23+
java-version: ${{ matrix.java-version }}
24+
- name: Cache local Maven repository
25+
uses: actions/cache@v2
26+
with:
27+
path: ~/.m2/repository
28+
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
29+
restore-keys: |
30+
${{ runner.os }}-maven-
31+
- name: Unit Test
32+
run: mvn -P Unittest -B verify --file pom.xml
33+
34+
acceptance-test:
35+
needs: unit-test
36+
strategy:
37+
matrix:
38+
splunk-version:
39+
- "8.0"
40+
- "latest"
41+
runs-on: ubuntu-latest
42+
container: maven:3-jdk-8
43+
44+
services:
45+
splunk:
46+
image: splunk/splunk:${{matrix.splunk-version}}
47+
env:
48+
SPLUNK_START_ARGS: --accept-license
49+
SPLUNK_PASSWORD: changed!
50+
ports:
51+
- 8089
52+
- 8088
53+
- 5555
54+
- 15000
55+
- 10667
56+
- 10668/udp
57+
58+
steps:
59+
- uses: actions/checkout@v2
60+
- name: Set up JDK
61+
uses: actions/setup-java@v1
62+
with:
63+
java-version: 1.8
64+
- name: Cache local Maven repository
65+
uses: actions/cache@v2
66+
with:
67+
path: ~/.m2/repository
68+
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
69+
restore-keys: |
70+
${{ runner.os }}-maven-
71+
- name: Acceptance Test
72+
run: mvn -P AcceptanceTest -B verify --file pom.xml
73+
env:
74+
SPLUNK_PASSWORD: changed!
75+
SPLUNK_HOST: splunk

Makefile

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
# text reset
2+
NO_COLOR=\033[0m
3+
# green
4+
OK_COLOR=\033[32;01m
5+
# red
6+
ERROR_COLOR=\033[31;01m
7+
# cyan
8+
WARN_COLOR=\033[36;01m
9+
# yellow
10+
ATTN_COLOR=\033[33;01m
11+
12+
ROOT_DIR := $(shell git rev-parse --show-toplevel)
13+
14+
VERSION := `git describe --tags --dirty 2>/dev/null`
15+
COMMITHASH := `git rev-parse --short HEAD 2>/dev/null`
16+
DATE := `date "+%FT%T%z"`
17+
18+
.PHONY: all
19+
all: init test
20+
21+
init:
22+
@echo "$(ATTN_COLOR)==> init $(NO_COLOR)"
23+
24+
.PHONY: test
25+
test:
26+
@echo "$(ATTN_COLOR)==> test $(NO_COLOR)"
27+
@echo "Running Unit test"
28+
@mvn -P Unittest -B verify --file pom.xml
29+
@echo "Running Acceptance test"
30+
@mvn -P AcceptanceTest -B verify --file pom.xml
31+
32+
.PHONY: test_specific
33+
test_specific:
34+
@echo "$(ATTN_COLOR)==> test_specific $(NO_COLOR)"
35+
@sh ./scripts/test_specific.sh
36+
37+
.PHONY: up
38+
up:
39+
@echo "$(ATTN_COLOR)==> up $(NO_COLOR)"
40+
@docker-compose up -d
41+
42+
.PHONY: wait_up
43+
wait_up:
44+
@echo "$(ATTN_COLOR)==> wait_up $(NO_COLOR)"
45+
@for i in `seq 0 180`; do if docker exec -it splunk /sbin/checkstate.sh &> /dev/null; then break; fi; printf "\rWaiting for Splunk for %s seconds..." $$i; sleep 1; done
46+
47+
.PHONY: down
48+
down:
49+
@echo "$(ATTN_COLOR)==> down $(NO_COLOR)"
50+
@docker-compose stop

docker-compose.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
version: '3.8'
2+
3+
services:
4+
splunk:
5+
image: splunk/splunk:latest
6+
container_name: splunk
7+
environment:
8+
- SPLUNK_START_ARGS=--accept-license
9+
- SPLUNK_PASSWORD=changed!
10+
ports:
11+
- 8000:8000
12+
- 5555:5555
13+
- 8088:8088
14+
- 8089:8089
15+
- 15000:15000
16+
- 10667:10667
17+
- 10668:10668/udp
18+
healthcheck:
19+
test: ['CMD', 'curl', '-f', 'https://localhost:8000']
20+
interval: 5s
21+
timeout: 5s
22+
retries: 20

scripts/test_specific.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
echo "To run a specific test:"
2+
echo " mvn test -Dtest=[testclass]"

0 commit comments

Comments
 (0)