diff --git a/.github/workflows/integration.yml b/.github/workflows/integration.yml new file mode 100644 index 00000000..ef2800eb --- /dev/null +++ b/.github/workflows/integration.yml @@ -0,0 +1,18 @@ +name: Integration + +on: + push: + schedule: + - cron: '0 0 * * 0' # Run weekly at midnight on Sunday + +jobs: + integration: + name: Integration + runs-on: ubuntu-latest + steps: + + - name: Check out code into the Go module directory + uses: actions/checkout@v3 + + - name: Integration Tests + run: make test-integration diff --git a/GNUmakefile b/GNUmakefile index 88d6e16b..187ba0d6 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -10,10 +10,12 @@ fmtcheck \ pretest \ test \ + test-integration \ unused \ cov \ clean \ build-integration \ + build-container \ clean-integration \ fetch-rdb \ fetch-redis \ @@ -21,7 +23,8 @@ diff-package \ diff-server-rdb \ diff-server-redis \ - diff-server-rdb-redis + diff-server-rdb-redis \ + start-postgres SRCS = $(shell git ls-files '*.go') PKGS = $(shell go list ./...) @@ -68,6 +71,20 @@ pretest: lint vet fmtcheck test: pretest $(GO) test -cover -v ./... || exit; +test-integration-cleanup: + @docker-compose down + +test-integration: start-postgres build-container run-update-alpine run-update-amazon run-update-debian run-update-fedora run-update-oracle run-update-redhat run-update-opensuse run-update-ubuntu test-integration-cleanup + +start-postgres: + @docker-compose up -d postgres-oval + +run-update-%: + @docker-compose up --exit-code-from=goval-updater-$(*) goval-updater-$(*) + +build-container: + @docker build --no-cache -t local-goval . + unused: $(foreach pkg,$(PKGS),unused $(pkg);) diff --git a/docker-compose.yaml b/docker-compose.yaml new file mode 100644 index 00000000..65480f60 --- /dev/null +++ b/docker-compose.yaml @@ -0,0 +1,180 @@ +version: "3.9" +services: + + goval-server: + container_name: goval-server + image: local-goval + restart: always + networks: + - goval-tester + expose: + - "80" + command: + - "server" + - "--bind=0.0.0.0" + - "--port=80" + - "--dbtype=postgres" + - "--dbpath=postgres://hello:world@postgres-oval:5432/goval" + + goval-updater-alpine: + container_name: goval-updater-alpine + image: local-goval + restart: "no" + networks: + - goval-tester + command: + - "fetch" + - "alpine" + - "3.2" + - "3.3" + - "3.4" + - "3.5" + - "3.6" + - "3.7" + - "3.8" + - "3.9" + - "3.10" + - "3.11" + - "3.12" + - "3.13" + - "3.14" + - "3.15" + - "--dbtype=postgres" + - "--dbpath=postgres://hello:world@postgres-oval:5432/goval" + + goval-updater-amazon: + container_name: goval-updater-amazon + image: local-goval + restart: "no" + networks: + - goval-tester + command: + - "fetch" + - "amazon" + - "--dbtype=postgres" + - "--dbpath=postgres://hello:world@postgres-oval:5432/goval" + + goval-updater-debian: + container_name: goval-updater-debian + image: local-goval + restart: "no" + networks: + - goval-tester + command: + - "fetch" + - "debian" + - "7" + - "8" + - "9" + - "10" + - "11" + - "--dbtype=postgres" + - "--dbpath=postgres://hello:world@postgres-oval:5432/goval" + + goval-updater-fedora: + container_name: goval-updater-fedora + image: local-goval + restart: "no" + networks: + - goval-tester + command: + - "fetch" + - "fedora" + - "36" + - "37" + - "--dbtype=postgres" + - "--dbpath=postgres://hello:world@postgres-oval:5432/goval" + + goval-updater-oracle: + container_name: goval-updater-oracle + image: local-goval + restart: "no" + networks: + - goval-tester + command: + - "fetch" + - "oracle" + - "--dbtype=postgres" + - "--dbpath=postgres://hello:world@postgres-oval:5432/goval" + + + goval-updater-redhat: + container_name: goval-updater-redhat + image: local-goval + restart: "no" + networks: + - goval-tester + command: + - "fetch" + - "redhat" + - "5" + - "6" + - "7" + - "8" + - "9" + - "--dbtype=postgres" + - "--dbpath=postgres://hello:world@postgres-oval:5432/goval" + + goval-updater-opensuse: + container_name: goval-updater-suse + image: local-goval + restart: "no" + networks: + - goval-tester + command: + - "fetch" + - "suse" + - "--suse-type" + - "opensuse" + - "10.2" + - "10.3" + - "11.0" + - "11.1" + - "11.2" + - "11.3" + - "11.4" + - "12.1" + - "12.2" + - "12.3" + - "13.1" + - "13.2" + - "tumbleweed" + - "--dbtype=postgres" + - "--dbpath=postgres://hello:world@postgres-oval:5432/goval" + + goval-updater-ubuntu: + container_name: goval-updater-ubuntu + image: local-goval + restart: "no" + networks: + - goval-tester + command: + - "fetch" + - "ubuntu" + - "14" + - "16" + - "18" + - "19" + - "20" + - "21" + - "22" + - "--dbtype=postgres" + - "--dbpath=postgres://hello:world@postgres-oval:5432/goval" + - "--debug" + + postgres-oval: + container_name: postgres-oval + image: postgres:14.1-alpine + restart: always + expose: + - "5432" + networks: + - goval-tester + environment: + - PGDATA=/var/lib/postgresql/data/pgdata + - POSTGRES_PASSWORD=world + - POSTGRES_USER=hello + - POSTGRES_DB=goval + +networks: + goval-tester: