Skip to content
Snippets Groups Projects
Unverified Commit 0b3d007e authored by jonastheis's avatar jonastheis
Browse files

Move tester to own module and don't build container but use existing golang one instead

parent d793d438
No related branches found
No related tags found
No related merge requests found
name: Test GoShimmer
on:
push:
pull_request:
types: [opened, reopened]
jobs:
integration-test:
name: Integration Tests
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v2
- name: Build GoShimmer Docker network
run: docker-compose -f tools/integration-tests/docker-compose.yml up -d --scale peer_replica=5 --build
- name: Dispay containers
run: docker ps -a
- name: Run integration tests
run: docker-compose -f tools/integration-tests/tester/docker-compose.yml up --abort-on-container-exit --exit-code-from tester --build
- name: Stop GoShimmer Docker network
if: always()
run: docker-compose -f tools/integration-tests/docker-compose.yml stop
- name: Create logs from containers in network
if: always()
run: |
docker logs entry_node > tools/integration-tests/logs/entry_node.log
docker logs peer_master > tools/integration-tests/logs/peer_master.log
docker logs integration-tests_peer_replica_1 > tools/integration-tests/logs/peer_replica_1.log
docker logs integration-tests_peer_replica_2 > tools/integration-tests/logs/peer_replica_2.log
docker logs integration-tests_peer_replica_3 > tools/integration-tests/logs/peer_replica_3.log
docker logs integration-tests_peer_replica_4 > tools/integration-tests/logs/peer_replica_4.log
docker logs integration-tests_peer_replica_5 > tools/integration-tests/logs/peer_replica_5.log
docker logs tester > tools/integration-tests/logs/tester.log
- name: Save logs as artifacts
if: always()
uses: actions/upload-artifact@v1
with:
name: container-logs
path: tools/integration-tests/logs
- name: Clean up
if: always()
run: docker-compose -f tools/integration-tests/docker-compose.yml down
......@@ -19,48 +19,4 @@ jobs:
uses: actions/checkout@v2
- name: Run Tests
run: go test ./packages/...
integration-test:
name: Integration Tests
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v2
- name: Build GoShimmer Docker network
run: docker-compose -f tools/integration-tests/docker-compose.yml up -d --scale peer_replica=5
- name: Dispay containers
run: docker ps -a
- name: Run integration tests
run: docker-compose -f tools/integration-tests/tester/docker-compose.yml up --exit-code-from tester
- name: Stop GoShimmer Docker network
if: always()
run: docker-compose -f tools/integration-tests/docker-compose.yml stop
- name: Create logs from containers in network
if: always()
run: |
docker logs entry_node > tools/integration-tests/logs/entry_node.log
docker logs peer_master > tools/integration-tests/logs/peer_master.log
docker logs integration-tests_peer_replica_1 > tools/integration-tests/logs/peer_replica_1.log
docker logs integration-tests_peer_replica_2 > tools/integration-tests/logs/peer_replica_2.log
docker logs integration-tests_peer_replica_3 > tools/integration-tests/logs/peer_replica_3.log
docker logs integration-tests_peer_replica_4 > tools/integration-tests/logs/peer_replica_4.log
docker logs integration-tests_peer_replica_5 > tools/integration-tests/logs/peer_replica_5.log
docker logs tester > tools/integration-tests/logs/tester.log
- name: Save logs as artifacts
if: always()
uses: actions/upload-artifact@v1
with:
name: container-logs
path: tools/integration-tests/logs
- name: Clean up
if: always()
run: docker-compose -f tools/integration-tests/docker-compose.yml down --rmi all --remove-orphan --volumes
run: go test ./...
############################
# Build
############################
# golang:1.14.0-buster
FROM golang@sha256:fc7e7c9c4b0f6d2d5e8611ee73b9d1d3132750108878517bbf988aa772359ae4 AS build
# Ensure ca-certficates are up to date
RUN update-ca-certificates
# Set the current Working Directory inside the container
RUN mkdir /goshimmer
WORKDIR /goshimmer
# Use Go Modules
COPY go.mod .
COPY go.sum .
ENV GO111MODULE=on
RUN go mod download
RUN go mod verify
# Copy everything from the current directory to the PWD(Present Working Directory) inside the container
COPY . .
ENTRYPOINT ["go", "test", "./tools/integration-tests/tester/tests", "-v"]
......@@ -5,10 +5,6 @@ go 1.14
require (
github.com/dgraph-io/badger/v2 v2.0.2
github.com/dgrijalva/jwt-go v3.2.0+incompatible
github.com/docker/distribution v2.7.1+incompatible // indirect
github.com/docker/docker v1.13.1
github.com/docker/go-connections v0.4.0 // indirect
github.com/docker/go-units v0.4.0 // indirect
github.com/gobuffalo/packr/v2 v2.7.1
github.com/golang/protobuf v1.3.4
github.com/googollee/go-engine.io v1.4.3-0.20190924125625-798118fc0dd2
......@@ -20,7 +16,6 @@ require (
github.com/labstack/gommon v0.3.0 // indirect
github.com/magiconair/properties v1.8.1
github.com/mr-tron/base58 v1.1.3
github.com/opencontainers/go-digest v1.0.0-rc1 // indirect
github.com/panjf2000/ants/v2 v2.2.2
github.com/pkg/errors v0.9.1
github.com/spf13/pflag v1.0.5
......
......@@ -56,14 +56,6 @@ github.com/dgryski/go-farm v0.0.0-20190323231341-8198c7b169ec/go.mod h1:SqUrOPUn
github.com/dgryski/go-farm v0.0.0-20190423205320-6a90982ecee2 h1:tdlZCpZ/P9DhczCTSixgIKmwPv6+wP5DGjqLYw5SUiA=
github.com/dgryski/go-farm v0.0.0-20190423205320-6a90982ecee2/go.mod h1:SqUrOPUnsFjfmXRMNPybcSiG0BgUW2AuFH8PAnS2iTw=
github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no=
github.com/docker/distribution v2.7.1+incompatible h1:a5mlkVzth6W5A4fOsS3D2EO5BUmsJpcB+cRlLU7cSug=
github.com/docker/distribution v2.7.1+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w=
github.com/docker/docker v1.13.1 h1:IkZjBSIc8hBjLpqeAbeE5mca5mNgeatLHBy3GO78BWo=
github.com/docker/docker v1.13.1/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk=
github.com/docker/go-connections v0.4.0 h1:El9xVISelRB7BuFusrZozjnkIM5YnzCViNKohAFqRJQ=
github.com/docker/go-connections v0.4.0/go.mod h1:Gbd7IOopHjR8Iph03tsViu4nIes5XhDvyHbTtUxmeec=
github.com/docker/go-units v0.4.0 h1:3uh0PgVws3nIA0Q+MwDC8yjEPf9zjRfZZWXZYDct3Tw=
github.com/docker/go-units v0.4.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk=
github.com/dustin/go-humanize v1.0.0 h1:VSnTsYCnlFHaM2/igO1h6X3HA71jcobQuxemgkq4zYo=
github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk=
github.com/emirpasic/gods v1.12.0 h1:QAUIPSaCu4G+POclxeqb3F+WPpdKqFGlw36+yOzGlrg=
......@@ -139,10 +131,6 @@ github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T
github.com/hpcloud/tail v1.0.0 h1:nfCOvKYfkgYP8hkirhJocXT2+zOD8yUNjXaWfTlyFKI=
github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8=
github.com/iotaledger/hive.go v0.0.0-20200330121034-e4a505bcf2cd h1:GZ9zGBj+tK1jHqTD5+OoPLVVlk/sB2pkKmQt9vjR8uY=
github.com/iotaledger/hive.go v0.0.0-20200330121034-e4a505bcf2cd/go.mod h1:LYUD1U+BxF+OY6zCZ4xp38vzjp/QWbUdCw9iwmxkGnc=
github.com/iotaledger/hive.go v0.0.0-20200402231254-50e5bddb0da0 h1:Es3rPblh28a68LctnLwqhUOphmtkD8Q3UVKZoZYSlDM=
github.com/iotaledger/hive.go v0.0.0-20200402231254-50e5bddb0da0/go.mod h1:LYUD1U+BxF+OY6zCZ4xp38vzjp/QWbUdCw9iwmxkGnc=
github.com/iotaledger/hive.go v0.0.0-20200403132600-4c10556e08a0 h1:CyUsunZHlWuD1s9GVz+XqAIZVpRDxJBspb4DheJVknw=
github.com/iotaledger/hive.go v0.0.0-20200403132600-4c10556e08a0/go.mod h1:LYUD1U+BxF+OY6zCZ4xp38vzjp/QWbUdCw9iwmxkGnc=
github.com/iotaledger/iota.go v1.0.0-beta.9/go.mod h1:F6WBmYd98mVjAmmPVYhnxg8NNIWCjjH8VWT9qvv3Rc8=
......@@ -205,8 +193,6 @@ github.com/onsi/ginkgo v1.8.0 h1:VkHVNpR4iVnU8XQR6DBm8BqYjN7CRzw+xKUbVVbbW9w=
github.com/onsi/ginkgo v1.8.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
github.com/onsi/gomega v1.5.0 h1:izbySO9zDPmjJ8rDjLvkA2zJHIo+HkYXHnf7eN7SSyo=
github.com/onsi/gomega v1.5.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY=
github.com/opencontainers/go-digest v1.0.0-rc1 h1:WzifXhOVOEOuFYOJAW6aQqW0TooG2iki3E3Ii+WN7gQ=
github.com/opencontainers/go-digest v1.0.0-rc1/go.mod h1:cMLVZDEM3+U2I4VmLI6N8jQYUd2OVphdqWwCJHrFt2s=
github.com/openzipkin/zipkin-go v0.1.1/go.mod h1:NtoC/o8u3JlF1lSlyPNswIbeQH9bJTmOf0Erfk+hxe8=
github.com/panjf2000/ants/v2 v2.2.2 h1:TWzusBjq/IflXhy+/S6u5wmMLCBdJnB9tPIx9Zmhvok=
github.com/panjf2000/ants/v2 v2.2.2/go.mod h1:1GFm8bV8nyCQvU5K4WvBCTG1/YBFOD2VzjffD8fV55A=
......
......@@ -7,7 +7,7 @@ Running the integration tests spins up a GoShimmer network within Docker as sche
The peers can communicate freely within the Docker network and this is exactly how the tests are run using the `tester` container.
Test can be written in regular Go style while the framework provides convenience functions to access a specific peer's web API or logs.
The visualizer, `master_peer's` dashboard and web API are reachable from the host system on the respective ports.
The autopeering network visualizer, `master_peer's` dashboard and web API are reachable from the host system on the respective ports.
The different containers (`entry_node`, `peer_master`, `peer_replica`) load separate config files that can be modified as necessary, respectively.
......
version: "3.7"
version: "3.5"
services:
entry_node:
......
......@@ -8,14 +8,14 @@ fi
REPLICAS=$1
echo "Build GoShimmer Docker network"
docker-compose -f docker-compose.yml up -d --scale peer_replica=$REPLICAS
docker-compose -f docker-compose.yml up -d --scale peer_replica=$REPLICAS --build
if [ $? -ne 0 ]; then { echo "Failed, aborting." ; exit 1; } fi
echo "Dispay containers"
docker ps -a
echo "Run integration tests"
docker-compose -f tester/docker-compose.yml up --exit-code-from tester
docker-compose -f tester/docker-compose.yml up --abort-on-container-exit --exit-code-from tester --build
echo "Create logs from containers in network"
docker-compose -f docker-compose.yml stop
......@@ -28,5 +28,5 @@ docker logs integration-tests_peer_replica_$c > logs/peer_replica_$c.log
done
echo "Clean up"
docker-compose -f tester/docker-compose.yml down --rmi all --remove-orphan --volumes
docker-compose -f docker-compose.yml down --rmi all --remove-orphan --volumes
docker-compose -f tester/docker-compose.yml down
docker-compose -f docker-compose.yml down
version: "3.7"
version: "3.5"
services:
tester:
image: iotaledger/goshimmer_tester
container_name: tester
build:
context: ../../..
dockerfile: Dockerfile-tester
image: golang:1.14
working_dir: /go/src/github.com/iotaledger/goshimmer/tools/integration-tests/tester
entrypoint: go test ./tests -v -mod=readonly
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- /var/run/docker.sock:/var/run/docker.sock:ro
- ../../..:/go/src/github.com/iotaledger/goshimmer:ro
networks:
- integration-test
......
module github.com/iotaledger/goshimmer/tools/integration-tests/tester
go 1.14
require (
github.com/Microsoft/go-winio v0.4.14 // indirect
github.com/docker/distribution v2.7.1+incompatible // indirect
github.com/docker/docker v1.13.1
github.com/docker/go-connections v0.4.0 // indirect
github.com/docker/go-units v0.4.0 // indirect
github.com/iotaledger/goshimmer v0.1.3
github.com/opencontainers/go-digest v1.0.0-rc1 // indirect
github.com/stretchr/testify v1.5.1
)
replace github.com/iotaledger/goshimmer => ../../..
This diff is collapsed.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment