Skip to content

Commit 2acd0ef

Browse files
authored
Merge pull request #4729 from grafana/dev
v1.8.6
2 parents b53116e + b27a158 commit 2acd0ef

File tree

88 files changed

+1437
-533
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

88 files changed

+1437
-533
lines changed

.github/pull_request_template.md

+3-2
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,11 @@
22

33
## Which issue(s) this PR closes
44

5-
Closes [issue link here]
5+
Related to [issue link here]
66

77
<!--
8-
*Note*: if you have more than one GitHub issue that this PR closes, be sure to preface
8+
*Note*: If you want the issue to be auto-closed once the PR is merged, change "Related to" to "Closes" in the line above.
9+
If you have more than one GitHub issue that this PR closes, be sure to preface
910
each issue link with a [closing keyword](https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting/using-keywords-in-issues-and-pull-requests#linking-a-pull-request-to-an-issue).
1011
This ensures that the issue(s) are auto-closed once the PR has been merged.
1112
-->

.github/workflows/e2e-tests.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ jobs:
150150
if: inputs.run-expensive-tests
151151
shell: bash
152152
env:
153-
E2E_TESTS_CMD: "cd grafana-plugin && yarn test:e2e-expensive"
153+
E2E_TESTS_CMD: "cd ../../grafana-plugin && yarn test:e2e-expensive"
154154
GRAFANA_VERSION: ${{ inputs.grafana_version }}
155155
GRAFANA_ADMIN_USERNAME: "irm"
156156
GRAFANA_ADMIN_PASSWORD: "irm"

.tilt/backend/Tiltfile

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
label = "OnCall.Backend"
2+
3+
k8s_resource(
4+
workload="celery",
5+
resource_deps=["mariadb", "redis-master"],
6+
labels=[label],
7+
)
8+
9+
k8s_resource(
10+
workload="engine",
11+
port_forwards=8080,
12+
resource_deps=["mariadb", "redis-master"],
13+
labels=[label],
14+
)
15+
16+
k8s_resource(workload="engine-migrate", labels=[label])

.tilt/deps/Tiltfile

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
label = "OnCall.Deps"
2+
3+
k8s_resource(workload="redis-master", labels=[label])
4+
5+
k8s_resource(workload="prometheus-server", labels=[label])
6+
7+
k8s_resource(
8+
workload="mariadb",
9+
port_forwards='3307:3306', # <host_port>:<container_port>
10+
labels=[label],
11+
)

.tilt/plugin/Tiltfile

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
label = "OnCall.Plugin"
2+
3+
is_ci=config.tilt_subcommand == "ci"
4+
grafana_plugin_dir="../../grafana-plugin"
5+
6+
# On CI dependencies are installed separately so we just build prod bundle to be consumed by Grafana dev server
7+
if is_ci:
8+
local_resource(
9+
"build-ui",
10+
labels=[label],
11+
dir=grafana_plugin_dir,
12+
cmd="yarn build",
13+
allow_parallel=True,
14+
)
15+
16+
# Locally we install dependencies and we run watch mode
17+
if not is_ci:
18+
local_resource(
19+
"build-ui",
20+
labels=[label],
21+
dir=grafana_plugin_dir,
22+
cmd="yarn install",
23+
serve_dir=grafana_plugin_dir,
24+
serve_cmd="yarn watch",
25+
allow_parallel=True,
26+
)

.tilt/tests/Tiltfile

+80
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
label = "OnCall.AllTests"
2+
3+
load('ext://uibutton', 'cmd_button', 'location', 'text_input', 'bool_input')
4+
5+
e2e_tests_cmd=os.getenv("E2E_TESTS_CMD", "cd ../../grafana-plugin && yarn test:e2e")
6+
is_ci=config.tilt_subcommand == "ci"
7+
8+
local_resource(
9+
"e2e-tests",
10+
labels=[label],
11+
cmd=e2e_tests_cmd,
12+
trigger_mode=TRIGGER_MODE_MANUAL,
13+
auto_init=is_ci,
14+
resource_deps=["build-ui", "grafana", "grafana-oncall-app-provisioning-configmap", "engine", "celery"]
15+
)
16+
17+
cmd_button(
18+
name="E2E Tests - headless run",
19+
argv=["sh", "-c", "yarn --cwd ./grafana-plugin test:e2e $STOP_ON_FIRST_FAILURE $TESTS_FILTER"],
20+
text="Restart headless run",
21+
resource="e2e-tests",
22+
icon_name="replay",
23+
inputs=[
24+
text_input("BROWSERS", "Browsers (e.g. \"chromium,firefox,webkit\")", "chromium", "chromium,firefox,webkit"),
25+
text_input("TESTS_FILTER", "Test filter (e.g. \"timezones.test quality.test\")", "", "Test file names to run"),
26+
bool_input("STOP_ON_FIRST_FAILURE", "Stop on first failure", True, "-x", ""),
27+
]
28+
)
29+
30+
cmd_button(
31+
name="E2E Tests - open watch mode",
32+
argv=["sh", "-c", "yarn --cwd grafana-plugin test:e2e:watch"],
33+
text="Open watch mode",
34+
resource="e2e-tests",
35+
icon_name="visibility",
36+
)
37+
38+
cmd_button(
39+
name="E2E Tests - show report",
40+
argv=["sh", "-c", "yarn --cwd grafana-plugin playwright show-report"],
41+
text="Show last HTML report",
42+
resource="e2e-tests",
43+
icon_name="assignment",
44+
)
45+
46+
cmd_button(
47+
name="E2E Tests - stop current run",
48+
argv=["sh", "-c", "kill -9 $(pgrep -f test:e2e)"],
49+
text="Stop",
50+
resource="e2e-tests",
51+
icon_name="dangerous",
52+
)
53+
54+
# Inspired by https://github.com/grafana/slo/blob/main/Tiltfile#L72
55+
pod_engine_pytest_script = '''
56+
set -eu
57+
# get engine k8s pod name from tilt resource name
58+
POD_NAME="$(tilt get kubernetesdiscovery "engine" -ojsonpath='{.status.pods[0].name}')"
59+
kubectl exec "$POD_NAME" -- pytest . $STOP_ON_FIRST_FAILURE $TESTS_FILTER
60+
'''
61+
local_resource(
62+
"pytest-tests",
63+
labels=[label],
64+
cmd=['sh', '-c', pod_engine_pytest_script],
65+
trigger_mode=TRIGGER_MODE_MANUAL,
66+
auto_init=False,
67+
resource_deps=["engine"]
68+
)
69+
70+
cmd_button(
71+
name="pytest Tests - headless run",
72+
argv=['sh', '-c', pod_engine_pytest_script],
73+
text="Run pytest",
74+
resource="pytest-tests",
75+
icon_name="replay",
76+
inputs=[
77+
text_input("TESTS_FILTER", "pytest optional arguments (e.g. \"apps/webhooks/tests/test_webhook.py::test_build_url_private_raises\")", "", "Test file names to run"),
78+
bool_input("STOP_ON_FIRST_FAILURE", "Stop on first failure", True, "-x", ""),
79+
]
80+
)

0 commit comments

Comments
 (0)