Skip to content
Snippets Groups Projects
Commit 2fc92dd7 authored by Neil-Jocelyn Schark's avatar Neil-Jocelyn Schark
Browse files

Merge branch 'fix-integration-tests' into 'develop'

Fix integration tests

See merge request !209
parents 743d230e 935003e0
Branches
Tags
7 merge requests!246Develop,!245Develop into Master,!244Master into develop2 into master,!219Draft: Testing,!214Test pipelines,!209Fix integration tests,!138Develop
Pipeline #86007 failed
...@@ -9,5 +9,4 @@ test ...@@ -9,5 +9,4 @@ test
.gitlab-ci.yaml .gitlab-ci.yaml
ARCHITECTURE.md ARCHITECTURE.md
CONTRIBUTING.md CONTRIBUTING.md
Dockerfile.alpine
README.md README.md
...@@ -40,7 +40,7 @@ variables: ...@@ -40,7 +40,7 @@ variables:
containerlab:template:integration: containerlab:template:integration:
extends: .containerlab_template extends: .containerlab_template
variables: variables:
CLAB_TEMPLATE: "${CI_PROJECT_DIR}/test/containerlab/complex-1.0.clab.tmpl.yml" CLAB_TEMPLATE: "${CI_PROJECT_DIR}/test/containerlab/int01.clab.tmpl.yml"
containerlab:deploy:integration: containerlab:deploy:integration:
...@@ -52,12 +52,7 @@ containerlab:deploy:integration: ...@@ -52,12 +52,7 @@ containerlab:deploy:integration:
echo -e "\ echo -e "\
GOSDN_HTTP_PORT=$(docker_host_port 8080 clab-${CLAB_NAME}-gosdn)\n\ GOSDN_HTTP_PORT=$(docker_host_port 8080 clab-${CLAB_NAME}-gosdn)\n\
GOSDN_GRPC_PORT=$(docker_host_port 55055 clab-${CLAB_NAME}-gosdn)\n\ GOSDN_GRPC_PORT=$(docker_host_port 55055 clab-${CLAB_NAME}-gosdn)\n\
CEOS1_1_PORT=$(docker_host_port 6030 clab-${CLAB_NAME}-ceos1-1)\n\ CEOS1_PORT=$(docker_host_port 6030 clab-${CLAB_NAME}-ceos1)" \
CEOS1_2_PORT=$(docker_host_port 6030 clab-${CLAB_NAME}-ceos1-2)\n\
CEOS2_1_1_PORT=$(docker_host_port 6030 clab-${CLAB_NAME}-ceos2-1-1)\n\
CEOS2_1_2_PORT=$(docker_host_port 6030 clab-${CLAB_NAME}-ceos2-1-2)\n\
CEOS2_2_1_PORT=$(docker_host_port 6030 clab-${CLAB_NAME}-ceos2-2-1)\n\
CEOS2_2_2_PORT=$(docker_host_port 6030 clab-${CLAB_NAME}-ceos2-2-2)" \
> ${CI_PROJECT_DIR}/build.env > ${CI_PROJECT_DIR}/build.env
- cat ${CI_PROJECT_DIR}/build.env - cat ${CI_PROJECT_DIR}/build.env
artifacts: artifacts:
......
...@@ -3,10 +3,12 @@ ...@@ -3,10 +3,12 @@
stage: integration-test stage: integration-test
needs: needs:
- job: "containerlab:deploy:integration" - job: "containerlab:deploy:integration"
tags:
- integration-test-docker
variables: variables:
GOSDN_LOG: "nolog" GOSDN_LOG: "nolog"
GOSDN_TEST_API_ENDPOINT: "141.100.70.178:${GOSDN_GRPC_PORT}" GOSDN_TEST_API_ENDPOINT: "141.100.70.178:${GOSDN_GRPC_PORT}"
GOSDN_TEST_ENDPOINT: "141.100.70.178:${CEOS1_1_PORT}" CEOS_TEST_ENDPOINT: "141.100.70.178:${CEOS1_PORT}"
GOSDN_TEST_USER: "admin" GOSDN_TEST_USER: "admin"
GOSDN_TEST_PASSWORD: "admin" GOSDN_TEST_PASSWORD: "admin"
...@@ -14,8 +16,7 @@ ...@@ -14,8 +16,7 @@
integration-test:nucleus: integration-test:nucleus:
<<: *integration-test <<: *integration-test
script: script:
- ${CI_PROJECT_DIR}/.gitlab/ci/scripts/wait-for-it.sh ${GOSDN_TEST_ENDPOINT} -s -t 180 -- echo "CEOS is up" - ${CI_PROJECT_DIR}/.gitlab/ci/scripts/wait-for-it.sh ${CEOS_TEST_ENDPOINT} -s -t 180 -- echo "CEOS is up"
- sleep 30
- cd ./test/integration - cd ./test/integration
- go test -race -v -run TestGnmi_SetIntegration - go test -race -v -run TestGnmi_SetIntegration
- go test -race -v -run TestGnmi_GetIntegration - go test -race -v -run TestGnmi_GetIntegration
......
...@@ -16,7 +16,6 @@ ...@@ -16,7 +16,6 @@
unit-test: unit-test:
script: script:
- gotestsum --junitfile report.xml --format testname -- -short -race $(go list ./... | grep -v /forks/ | grep -v /mocks ) -v -coverprofile=coverage.out - gotestsum --junitfile report.xml --format testname -- -short -race $(go list ./... | grep -v /forks/ | grep -v /mocks ) -v -coverprofile=coverage.out
# -short -race $(go list ./... | grep -v /forks/ | grep -v /mocks ) -v
after_script: after_script:
- go tool cover -func=coverage.out - go tool cover -func=coverage.out
<<: *test <<: *test
......
# syntax = docker/dockerfile:1.2
FROM golang:1.16-alpine AS builder
ARG GITLAB_USER
ARG GITLAB_TOKEN
ARG BUILDARGS
WORKDIR /src/gosdn
RUN apk add --no-cache git
RUN git config --global url."https://$GITLAB_USER:$GITLAB_TOKEN@code.fbi.h-da.de".insteadOf "https://code.fbi.h-da.de"
COPY go.* .
RUN go mod download
COPY . .
RUN --mount=type=cache,target=/root/.cache/go-build \
GOOS=linux go build -o gosdn ./cmd/gosdn
FROM alpine
EXPOSE 8080
EXPOSE 55055
COPY --from=builder /src/gosdn/gosdn .
COPY --from=builder /src/gosdn/configs ./configs
ENTRYPOINT [ "./gosdn" ]
CMD [""]
...@@ -132,10 +132,10 @@ func TestMain(m *testing.M) { ...@@ -132,10 +132,10 @@ func TestMain(m *testing.M) {
func bootstrapIntegrationTest() { func bootstrapIntegrationTest() {
log.SetLevel(config.LogLevel) log.SetLevel(config.LogLevel)
addr := os.Getenv("GOSDN_TEST_ENDPOINT") addr := os.Getenv("CEOS_TEST_ENDPOINT")
if addr != "" { if addr != "" {
testAddress = addr testAddress = addr
log.Infof("GOSDN_TEST_ENDPOINT set to %v", testAddress) log.Infof("CEOS_TEST_ENDPOINT set to %v", testAddress)
} }
api := os.Getenv("GOSDN_TEST_API_ENDPOINT") api := os.Getenv("GOSDN_TEST_API_ENDPOINT")
if api != "" { if api != "" {
......
...@@ -45,10 +45,10 @@ func testSetupIntegration() { ...@@ -45,10 +45,10 @@ func testSetupIntegration() {
log.SetLevel(log.PanicLevel) log.SetLevel(log.PanicLevel)
} }
addr := os.Getenv("GOSDN_TEST_ENDPOINT") addr := os.Getenv("CEOS_TEST_ENDPOINT")
if addr != "" { if addr != "" {
testAddress = addr testAddress = addr
log.Infof("GOSDN_TEST_ENDPOINT set to %v", testAddress) log.Infof("CEOS_TEST_ENDPOINT set to %v", testAddress)
} }
u := os.Getenv("GOSDN_TEST_USER") u := os.Getenv("GOSDN_TEST_USER")
if u != "" { if u != "" {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment