Skip to content

Commit

Permalink
Merge pull request #4729 from grafana/dev
Browse files Browse the repository at this point in the history
v1.8.6
  • Loading branch information
vadimkerr authored Jul 24, 2024
2 parents b53116e + b27a158 commit 2acd0ef
Show file tree
Hide file tree
Showing 88 changed files with 1,437 additions and 533 deletions.
5 changes: 3 additions & 2 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@

## Which issue(s) this PR closes

Closes [issue link here]
Related to [issue link here]

<!--
*Note*: if you have more than one GitHub issue that this PR closes, be sure to preface
*Note*: If you want the issue to be auto-closed once the PR is merged, change "Related to" to "Closes" in the line above.
If you have more than one GitHub issue that this PR closes, be sure to preface
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).
This ensures that the issue(s) are auto-closed once the PR has been merged.
-->
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/e2e-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ jobs:
if: inputs.run-expensive-tests
shell: bash
env:
E2E_TESTS_CMD: "cd grafana-plugin && yarn test:e2e-expensive"
E2E_TESTS_CMD: "cd ../../grafana-plugin && yarn test:e2e-expensive"
GRAFANA_VERSION: ${{ inputs.grafana_version }}
GRAFANA_ADMIN_USERNAME: "irm"
GRAFANA_ADMIN_PASSWORD: "irm"
Expand Down
16 changes: 16 additions & 0 deletions .tilt/backend/Tiltfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
label = "OnCall.Backend"

k8s_resource(
workload="celery",
resource_deps=["mariadb", "redis-master"],
labels=[label],
)

k8s_resource(
workload="engine",
port_forwards=8080,
resource_deps=["mariadb", "redis-master"],
labels=[label],
)

k8s_resource(workload="engine-migrate", labels=[label])
11 changes: 11 additions & 0 deletions .tilt/deps/Tiltfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
label = "OnCall.Deps"

k8s_resource(workload="redis-master", labels=[label])

k8s_resource(workload="prometheus-server", labels=[label])

k8s_resource(
workload="mariadb",
port_forwards='3307:3306', # <host_port>:<container_port>
labels=[label],
)
26 changes: 26 additions & 0 deletions .tilt/plugin/Tiltfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
label = "OnCall.Plugin"

is_ci=config.tilt_subcommand == "ci"
grafana_plugin_dir="../../grafana-plugin"

# On CI dependencies are installed separately so we just build prod bundle to be consumed by Grafana dev server
if is_ci:
local_resource(
"build-ui",
labels=[label],
dir=grafana_plugin_dir,
cmd="yarn build",
allow_parallel=True,
)

# Locally we install dependencies and we run watch mode
if not is_ci:
local_resource(
"build-ui",
labels=[label],
dir=grafana_plugin_dir,
cmd="yarn install",
serve_dir=grafana_plugin_dir,
serve_cmd="yarn watch",
allow_parallel=True,
)
80 changes: 80 additions & 0 deletions .tilt/tests/Tiltfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
label = "OnCall.AllTests"

load('ext://uibutton', 'cmd_button', 'location', 'text_input', 'bool_input')

e2e_tests_cmd=os.getenv("E2E_TESTS_CMD", "cd ../../grafana-plugin && yarn test:e2e")
is_ci=config.tilt_subcommand == "ci"

local_resource(
"e2e-tests",
labels=[label],
cmd=e2e_tests_cmd,
trigger_mode=TRIGGER_MODE_MANUAL,
auto_init=is_ci,
resource_deps=["build-ui", "grafana", "grafana-oncall-app-provisioning-configmap", "engine", "celery"]
)

cmd_button(
name="E2E Tests - headless run",
argv=["sh", "-c", "yarn --cwd ./grafana-plugin test:e2e $STOP_ON_FIRST_FAILURE $TESTS_FILTER"],
text="Restart headless run",
resource="e2e-tests",
icon_name="replay",
inputs=[
text_input("BROWSERS", "Browsers (e.g. \"chromium,firefox,webkit\")", "chromium", "chromium,firefox,webkit"),
text_input("TESTS_FILTER", "Test filter (e.g. \"timezones.test quality.test\")", "", "Test file names to run"),
bool_input("STOP_ON_FIRST_FAILURE", "Stop on first failure", True, "-x", ""),
]
)

cmd_button(
name="E2E Tests - open watch mode",
argv=["sh", "-c", "yarn --cwd grafana-plugin test:e2e:watch"],
text="Open watch mode",
resource="e2e-tests",
icon_name="visibility",
)

cmd_button(
name="E2E Tests - show report",
argv=["sh", "-c", "yarn --cwd grafana-plugin playwright show-report"],
text="Show last HTML report",
resource="e2e-tests",
icon_name="assignment",
)

cmd_button(
name="E2E Tests - stop current run",
argv=["sh", "-c", "kill -9 $(pgrep -f test:e2e)"],
text="Stop",
resource="e2e-tests",
icon_name="dangerous",
)

# Inspired by https://github.com/grafana/slo/blob/main/Tiltfile#L72
pod_engine_pytest_script = '''
set -eu
# get engine k8s pod name from tilt resource name
POD_NAME="$(tilt get kubernetesdiscovery "engine" -ojsonpath='{.status.pods[0].name}')"
kubectl exec "$POD_NAME" -- pytest . $STOP_ON_FIRST_FAILURE $TESTS_FILTER
'''
local_resource(
"pytest-tests",
labels=[label],
cmd=['sh', '-c', pod_engine_pytest_script],
trigger_mode=TRIGGER_MODE_MANUAL,
auto_init=False,
resource_deps=["engine"]
)

cmd_button(
name="pytest Tests - headless run",
argv=['sh', '-c', pod_engine_pytest_script],
text="Run pytest",
resource="pytest-tests",
icon_name="replay",
inputs=[
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"),
bool_input("STOP_ON_FIRST_FAILURE", "Stop on first failure", True, "-x", ""),
]
)
Loading

0 comments on commit 2acd0ef

Please sign in to comment.