-
Notifications
You must be signed in to change notification settings - Fork 2
113 lines (97 loc) · 4.17 KB
/
test.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
# This is a basic workflow to help you get started with Actions
name: test
# Controls when the workflow will run
on:
# Triggers the workflow on push or pull request events but only for the main branch
push:
pull_request:
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
test:
# The type of runner that the job will run on
runs-on: ubuntu-latest
env:
PATH_OUT_BASIC: build/out/basic
PATH_OUT_FULL: build/out/full
PATH_IN_FULL: testing/file/full/in
PATH_IN_BASIC: testing/file/basic/in
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v4
# printenv
- name: printenv
run: printenv
# PWD
- name: PWD
run: pwd
# install jq
- name: apt jq
run: sudo apt-get install -y jq
# Runs a set of commands using the runners shell
- name: prepare build folders
run: |
mkdir build
cp -r config build
cp -r docker build
cp -r testing/config/* build/config/
rm build/config/pipeline/output-elastic-logstash.conf
mkdir -p $PATH_OUT_BASIC
chmod +777 $PATH_OUT_BASIC
mkdir -p $PATH_OUT_FULL
chmod +777 $PATH_OUT_FULL
ls -lah build/config/pipeline
cp -r docker/elasticsearch build
ls -lah build
docker build -f build/elasticsearch/Dockerfile -t jmeter-logstash-elastic build
# Run docker
- name: Run docker basic
run: |
docker run --rm -e "FILE_READ_MODE=read" \
-e "FILE_START_POSITION=beginning" \
-e "FILE_EXIT_AFTER_READ=true" \
-v ${PWD}/$PATH_OUT_BASIC:/output/ \
-v ${PWD}/$PATH_IN_BASIC:/input/ \
jmeter-logstash-elastic
- name: Run docker FULL
run: |
docker run --rm -e "FILE_READ_MODE=read" \
-e "FILE_START_POSITION=beginning" \
-e "FILE_EXIT_AFTER_READ=true" \
-e "EXECUTION_ID=myexecution" \
-e "PROJECT_NAME=myproject" \
-e "ENVIRONMENT_NAME=myenv" \
-e "TEST_NAME=mytest" \
-e "TEST_METADATA=users=50,location=europe,key=myvalue" \
-e "TEST_TAGS=prd,tnr,mytag" \
-v ${PWD}/$PATH_OUT_FULL:/output/ \
-v ${PWD}/$PATH_IN_FULL:/input/ \
jmeter-logstash-elastic
- name: check Expected Files list
run: |
for testtype in basic full ; do
echo "Start check for ${testtype}"
export PATH_EXPECTED=testing/file/${testtype}/expected
echo "##CHECK expected folder $PATH_EXPECTED"
ls -la $PATH_EXPECTED
export PATH_OUT=build/out/${testtype}
echo "##CHECK PATH_OUT folder $PATH_OUT"
ls -la $PATH_OUT
for filepath in $PATH_EXPECTED/*.json; do
FILE_NAME=${filepath##*/}
echo "####START###############################$FILE_NAME#####################################"
EXPECTED_FILE=$PATH_EXPECTED/$FILE_NAME
OUT_FILE=$PATH_OUT/$FILE_NAME
echo "####OUT###############$FILE_NAME#####################"
jq --sort-keys 'del(.host) | del(."@timestamp") | del(.timestamp)' $OUT_FILE
echo "####OUT###############$FILE_NAME#####################"
echo "####EXPECTED##########$FILE_NAME#####################"
jq --sort-keys 'del(.host) | del(."@timestamp") | del(.timestamp)' $EXPECTED_FILE
echo "####EXPECTED##########$FILE_NAME#####################"
diff <(jq --sort-keys 'del(.host) | del(."@timestamp") | del(.timestamp)' $EXPECTED_FILE) <(jq --sort-keys 'del(.host) | del(."@timestamp") | del(.timestamp)' $OUT_FILE)
echo "####END###############################$FILE_NAME#####################################"
done
done