Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for timeseries panels #1

Merged
merged 2 commits into from
Oct 22, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.

19 changes: 19 additions & 0 deletions e2e/cypress/e2e/timeseries_panel_spec.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
const fs = require('fs')

describe('Timeseries Panel', function() {

let panelTitles = []

before(function() {
let testDir = './tests/timeseries_panel/test_compiled.json'
let uid = 'timeseries-panel'
panelTitles = cy.createDashboardFromUnitTests(testDir, uid)
})

it('renders all timeseries panels', function() {
cy.visit('/d/timeseries-panel/timeseries-panel')
for (const title of panelTitles) {
cy.contains(title)
}
})
})
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