Skip to content
This repository has been archived by the owner on Jun 26, 2023. It is now read-only.

Commit

Permalink
Upgrade e2e test dependencies
Browse files Browse the repository at this point in the history
- jsonnet to 18
- cypress to 10.9
- grafana to 9.2.1
  • Loading branch information
rhowe committed Oct 22, 2022
1 parent 3028019 commit a223233
Show file tree
Hide file tree
Showing 13 changed files with 2,418 additions and 909 deletions.
17 changes: 13 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
UID = $(shell id -u $(USER))
GID = $(shell id -g $(USER))

JSONNET_VERSION ?= 0.18.0

help: # Show this message.
@echo "\nAvailable Targets:\n"
@sed -ne '/@sed/!s/# //p' $(MAKEFILE_LIST)
Expand All @@ -11,7 +13,7 @@ test: # Run all unit tests.
-v $$PWD:$$PWD \
-u $(UID):$(GID) \
--entrypoint bash \
bitnami/jsonnet:0.16.0 \
bitnami/jsonnet:$(JSONNET_VERSION) \
tests.sh

test-update: # Run all unit tests while copying test_output.json to compiled.json file.
Expand All @@ -20,13 +22,15 @@ test-update: # Run all unit tests while copying test_output.json to compiled.js
-v $$PWD:$$PWD \
-u $(UID):$(GID) \
--entrypoint bash \
bitnami/jsonnet:0.16.0 \
bitnami/jsonnet:$(JSONNET_VERSION) \
tests.sh update

E2E_GRAFANA_VERSION ?= 7.1.1
E2E_GRAFANA_VERSION ?= 9.2.1
E2E_CYPRESS_BASE_VERSION ?= 16.17.1

e2e: # Run all end-to-end tests.
GRAFANA_VERSION=${E2E_GRAFANA_VERSION} \
CYPRESS_BASE_VERSION=${E2E_CYPRESS_BASE_VERSION} \
docker-compose -f e2e/docker-compose.yml up \
--abort-on-container-exit \
--exit-code-from e2e
Expand All @@ -38,6 +42,11 @@ e2e-dev: # Run e2e tests in Cypress test runner.
--abort-on-container-exit \
--exit-code-from e2e

e2e-npm-install:
docker run --rm -it -v "$$(pwd)/e2e:/e2e" -w /e2e \
-e CYPRESS_CACHE_FOLDER=/tmp "cypress/base:${E2E_CYPRESS_BASE_VERSION}" \
npm install

gen-api-docs: # Generate api-docs.md from source code comments.
@docker run --rm \
-w $$PWD \
Expand All @@ -49,4 +58,4 @@ gen-api-docs: # Generate api-docs.md from source code comments.
spec-import: # Import generated libraries from https://github.com/grafana/dashboard-spec.
svn export https://github.com/grafana/dashboard-spec/branches/_gen/_gen/7.0/jsonnet grafonnet-7.0 --force

.PHONY: help test test-update e2e gen-api-docs spec-import
.PHONY: help test test-update e2e e2e-dev e2e-npm-install gen-api-docs spec-import
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,8 @@ Please contribute! If you're interested, please start by reading the
[contributing guide](CONTRIBUTING.md). Before you begin work please take note of
our code of conduct and ensure that what you'd like to contribute is within the
scope of what Grafonnet attempts to support.

## Upgrading Cypress

- Update version numbers in e2e/package.json and e2e/docker-compose.dev.yml
- `make e2e-npm-install` to update e2e/package-lock.json
3 changes: 3 additions & 0 deletions e2e/Dockerfile.npm-install
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
ARG CYPRESS_BASE_TAG
FROM cypress/base:${CYPRESS_BASE_TAG}
CMD ["npm", "install"]
6 changes: 6 additions & 0 deletions e2e/cypress.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
const { defineConfig } = require('cypress')

module.exports = defineConfig({
e2e: { }
})

2 changes: 0 additions & 2 deletions e2e/cypress.json

This file was deleted.

File renamed without changes.
4 changes: 2 additions & 2 deletions e2e/docker-compose.dev.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
version: '3'
services:
grafana:
image: grafana/grafana:${GRAFANA_VERSION?err}
image: grafana/grafana:${GRAFANA_VERSION?}
ports:
- "3030:3000"
e2e:
build:
context: .
args:
CYPRESS_IMAGE: cypress/included:4.7.0
CYPRESS_IMAGE: cypress/included:10.9.0
image: grafonnet-e2e-dev
entrypoint: cypress open --project .
depends_on:
Expand Down
6 changes: 3 additions & 3 deletions e2e/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
version: '3'
services:
grafana:
image: grafana/grafana:${GRAFANA_VERSION?err}
image: grafana/grafana:${GRAFANA_VERSION?}
e2e:
build:
context: .
args:
CYPRESS_IMAGE: cypress/base:12
CYPRESS_IMAGE: cypress/base:${CYPRESS_BASE_VERSION?}
image: grafonnet-e2e
command: npx cypress run
depends_on:
Expand All @@ -16,5 +16,5 @@ services:
- CYPRESS_video=false
volumes:
- ./cypress:/e2e/cypress
- ./cypress.json:/e2e/cypress.json
- ./cypress.config.js:/e2e/cypress.config.js
- ../tests:/e2e/tests
Loading

0 comments on commit a223233

Please sign in to comment.