Skip to content

Commit

Permalink
Add dockerized library integration tests (weaveworks#732)
Browse files Browse the repository at this point in the history
* Add dockerized library integration test

* Fix test.yaml after bad merge
  • Loading branch information
jpellizzari authored Sep 13, 2021
1 parent dfa64de commit 22ec633
Show file tree
Hide file tree
Showing 6 changed files with 46 additions and 3 deletions.
13 changes: 13 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -259,3 +259,16 @@ jobs:
name: acceptance-test-artifacts
path: ${{ env.ARTIFACTS_BASE_DIR }}
retention-days: 1
library-integration-test:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Setup Docker Buildx
uses: docker/setup-buildx-action@94ab11c41e45d028884a99163086648e898eed25
- name: Run Library Integration Test
env:
GITHUB_TOKEN: "${{ secrets.github_token }}"
run: make lib-test


1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ coverage
*.lcov
ginkgo.report
.deps
test/library/wego-library-test
12 changes: 11 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ clean: ## Clean up images and binaries
rm -rf coverage
rm -rf node_modules
rm -f .deps
rm -rf dist

fmt: ## Run go fmt against code
go fmt ./...
Expand Down Expand Up @@ -127,7 +128,16 @@ cmd/wego/ui/run/dist/index.html: cmd/wego/ui/run/dist
cmd/wego/ui/run/dist/main.js:
npm run build

dist/index.js:
# Runs a test to raise errors if the integration between WeGO Core and EE is
# in danger of breaking due to package API changes.
# See the test/library dockerfile and test.sh script for more info.
lib-test: dependencies
docker build -t wego-library-test -f test/library/libtest.dockerfile $(CURRENT_DIR)/test/library
docker run -e GITHUB_TOKEN=$$GITHUB_TOKEN -i --rm \
-v $(CURRENT_DIR):/go/src/github.com/weaveworks/weave-gitops \
wego-library-test

dist/index.js: ui/index.ts
npm run build:lib && cp package.json dist

dist/index.d.ts:
Expand Down
9 changes: 9 additions & 0 deletions test/library/libtest.dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
FROM golang:1.16
RUN apt-get update
RUN apt-get -y install curl gnupg
RUN curl -sL https://deb.nodesource.com/setup_14.x | bash -
RUN apt-get -y install nodejs
COPY test.sh /test/test.sh
WORKDIR /test
CMD ./test.sh

10 changes: 10 additions & 0 deletions test/library/test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash
set -e
set -x

git clone https://github.com/weaveworks-gitops-test/wego-library-test.git test/library/wego-library-test
cd test/library/wego-library-test
npm ci
npm run build
go mod tidy
go build main.go
4 changes: 2 additions & 2 deletions ui/index.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import _LoadingPage from "./components/LoadingPage";
import _AppContextProvider from "./contexts/AppContext";
import _useApplications from "./hooks/applications";
import { Applications as appsClient } from "./lib/api/applications/applications.pb";
import _Theme from "./lib/theme";
import _ApplicationDetail from "./pages/ApplicationDetail";
import _Applications from "./pages/Applications";
import _useApplications from "./hooks/applications";
import _LoadingPage from "./components/LoadingPage";

export const theme = _Theme;
export const AppContextProvider = _AppContextProvider;
Expand Down

0 comments on commit 22ec633

Please sign in to comment.