File tree 7 files changed +571
-1
lines changed
7 files changed +571
-1
lines changed Original file line number Diff line number Diff line change @@ -49,13 +49,23 @@ jobs:
49
49
version : v1.28
50
50
working-directory : odfe-cli
51
51
52
- - name : Run Test
52
+ - name : Run Unit Tests
53
53
env :
54
54
GOPROXY : " https://proxy.golang.org"
55
55
run : |
56
56
go test ./... -coverprofile=coverage.out
57
57
go tool cover -func=coverage.out
58
58
59
+ - name : Run Docker Image
60
+ run : |
61
+ make docker.start.components
62
+ sleep 60
63
+
64
+ - name : Run Integration Tests
65
+ env :
66
+ GOPROXY : " https://proxy.golang.org"
67
+ run : make test.integration
68
+
59
69
- name : Upload coverage to Codecov
60
70
uses : codecov/codecov-action@v1.0.3
61
71
with :
Original file line number Diff line number Diff line change
1
+ # we will put our integration testing in this path
2
+ INTEGRATION_TEST_PATH =./it
3
+
4
+ # set of env variables that you need for testing
5
+ ENV_LOCAL_TEST =\
6
+ ODFE_ENDPOINT="https://localhost:9200" \
7
+ ODFE_USER="admin" \
8
+ ODFE_PASSWORD="admin"
9
+
10
+ # this command will start a docker components that we set in docker-compose.yml
11
+ docker.start.components :
12
+ docker-compose up -d;
13
+
14
+ # shutting down docker components
15
+ docker.stop :
16
+ docker-compose down;
17
+
18
+ # clean up docker
19
+ docker.clean :
20
+ docker system prune --volumes;
21
+
22
+ # this command will trigger integration test
23
+ # INTEGRATION_TEST_SUITE_PATH is used for run specific test in Golang
24
+ test.integration :
25
+ go clean -testcache;
26
+ $(ENV_LOCAL_TEST ) go test -tags=integration $(INTEGRATION_TEST_PATH ) ;
27
+
28
+ test.unit :
29
+ go clean -testcache;
30
+ go test ./...;
31
+
32
+ # format project using goimports tool
33
+ format :
34
+ goimports -w . ;
35
+
36
+ # generate odfe-cli file in current directory
37
+ # update GOOS / GOARCH if you want to build for other os and architecture
38
+ build :
39
+ go build .
Original file line number Diff line number Diff line change
1
+ # Copied from https://opendistro.github.io/for-elasticsearch-docs/docs/install/docker/
2
+ # removed node-2 since we don't need to create two node cluster for integration test
3
+ version : ' 3'
4
+ services :
5
+ odfe-test-node1 :
6
+ image : amazon/opendistro-for-elasticsearch:${ODFE_VERSION:-latest}
7
+ container_name : odfe-test-node1
8
+ environment :
9
+ - cluster.name=odfe-test-cluster
10
+ - node.name=odfe-test-node1
11
+ - discovery.seed_hosts=odfe-test-node1
12
+ - cluster.initial_master_nodes=odfe-test-node1
13
+ - bootstrap.memory_lock=true # along with the memlock settings below, disables swapping
14
+ - " ES_JAVA_OPTS=-Xms512m -Xmx512m" # minimum and maximum Java heap size, recommend setting both to 50% of system RAM
15
+ ulimits :
16
+ memlock :
17
+ soft : -1
18
+ hard : -1
19
+ nofile :
20
+ soft : 65536 # maximum number of open files for the Elasticsearch user, set to at least 65536 on modern systems
21
+ hard : 65536
22
+ volumes :
23
+ - odfe-test-data1:/usr/share/elasticsearch/data
24
+ ports :
25
+ - 9200:9200
26
+ - 9600:9600 # required for Performance Analyzer
27
+ networks :
28
+ - odfe-test-net
29
+
30
+ volumes :
31
+ odfe-test-data1 :
32
+
33
+ networks :
34
+ odfe-test-net :
Original file line number Diff line number Diff line change @@ -49,6 +49,7 @@ github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgf
49
49
github.com/grpc-ecosystem/grpc-gateway v1.9.0 /go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY =
50
50
github.com/hashicorp/go-cleanhttp v0.5.1 h1:dH3aiDG9Jvb5r5+bYHsikaOUIpcM0xvgMXVoDkXMzJM =
51
51
github.com/hashicorp/go-cleanhttp v0.5.1 /go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80 =
52
+ github.com/hashicorp/go-hclog v0.9.2 h1:CG6TE5H9/JXsFWJCfoIVpKFIkFe6ysEuHirp4DxCsHI =
52
53
github.com/hashicorp/go-hclog v0.9.2 /go.mod h1:5CU+agLiy3J7N7QjHK5d05KxGsuXiQLrjA0H7acj2lQ =
53
54
github.com/hashicorp/go-retryablehttp v0.6.7 h1:8/CAEZt/+F7kR7GevNHulKkUjLht3CPmn7egmhieNKo =
54
55
github.com/hashicorp/go-retryablehttp v0.6.7 /go.mod h1:vAew36LZh98gCBJNLH42IQ1ER/9wtLZZ8meHqQvEYWY =
You can’t perform that action at this time.
0 commit comments