Skip to content

Commit

Permalink
Merge branch 'master' of github.com:Altinity/clickhouse-grafana into …
Browse files Browse the repository at this point in the history
…issue-330
  • Loading branch information
Slach committed Nov 20, 2024
2 parents 2ec498d + 97fa62b commit 906e4a0
Show file tree
Hide file tree
Showing 8 changed files with 31 additions and 9 deletions.
6 changes: 5 additions & 1 deletion docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@ services:
npm run create_instrumented &&
cp -R -n src/* instrumented/ &&
npm run build:test
npm run test:coverage
'
frontend_coverage_generate:
Expand All @@ -194,7 +195,8 @@ services:
bash -xec '
if [[ "3" == `ls -la ./node_modules/ | wc -l` ]]; then npm install; fi && \
mkdir -p .nyc_output &&
cp tests/testflows/coverage/raw/* .nyc_output/
cp tests/testflows/coverage/raw/* .nyc_output/ &&
cp coverage/coverage-final.json .nyc_output/ &&
npx nyc report --reporter=html --report-dir=./tests/testflows/coverage
'
Expand All @@ -213,6 +215,8 @@ services:
bash -xec "
git config --global --add safe.directory /go/src/grafana-clickhouse &&
(command -v mage || go install -v github.com/magefile/mage@latest) &&
mkdir -p /go/src/grafana-clickhouse/coverage/raw &&
go test -timeout 1m -cover -failfast -tags=integration -run "${RUN_TESTS:-.+}" -v ./pkg/ -test.gocoverdir="/go/src/grafana-clickhouse/coverage/raw" &&
GOOS=linux GOARCH=amd64 go build -cover -buildvcs=false -o ./dist/altinity-clickhouse-plugin_linux_amd64 ./pkg/ &&
chmod +x dist/altinity-clickhouse-plugin*
"
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"build": "webpack -c ./.config/webpack/webpack.config.ts --env production",
"dev": "webpack -w -c ./.config/webpack/webpack.config.ts --env development",
"test": "jest",
"test:coverage": "jest --coverage",
"test:ci": "jest --passWithNoTests --maxWorkers 4",
"typecheck": "tsc --noEmit",
"lint": "eslint --cache --ignore-path ./.gitignore --ext .js,.jsx,.ts,.tsx .",
Expand Down
3 changes: 0 additions & 3 deletions tests/testflows/regression.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,6 @@ def argparser(parser):
"/Grafana Datasource Plugin For Clickhouse/data source setup/check default values datetime64/": [
(Error, "https://github.com/Altinity/clickhouse-grafana/issues/630")
],
"/Grafana Datasource Plugin For Clickhouse/sql editor/extrapolation toggle/":[
(Fail, "Run Query button do not update time ranges")
],
"/Grafana Datasource Plugin For Clickhouse/functions/rate function/rate_space_in_variable/*": [
(Fail, "Functions do not support escaping")
]
Expand Down
5 changes: 5 additions & 0 deletions tests/testflows/steps/panel/locators.py
Original file line number Diff line number Diff line change
Expand Up @@ -295,5 +295,10 @@ def query_inspector_close_button(self):
driver: WebDriver = current().context.driver
return driver.find_element(SelectBy.CSS_SELECTOR, f'[data-testid="data-testid Drawer close"]')

@property
def refresh_button(self):
driver: WebDriver = current().context.driver
return driver.find_element(SelectBy.CSS_SELECTOR, f'[data-testid="data-testid RefreshPicker run button"]')


locators = Locators()
6 changes: 6 additions & 0 deletions tests/testflows/steps/panel/view.py
Original file line number Diff line number Diff line change
Expand Up @@ -521,6 +521,12 @@ def click_save_confirmation_button(self):
locators.save_confirmations_button(grafana_version=self.context.grafana_version).click()


@TestStep(When)
def click_refresh_button(self):
"""Click refresh button."""

locators.refresh_button.click()

@TestStep(When)
def save_dashboard(self):
"""Save dashboard from panel view."""
Expand Down
4 changes: 3 additions & 1 deletion tests/testflows/tests/automated/data_source_setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -541,8 +541,10 @@ def check_default_values_datetime64(self):
RQ_SRS_Plugin_DataSourceSetupView("1.0"),
RQ_SRS_Plugin_DataSourceSetupView_DataSourceName("1.0"),
RQ_SRS_Plugin_DataSourceSetupView_SaveAndTestButton("1.0"),
RQ_SRS_Plugin_Dashboards("1.0"),
RQ_SRS_Plugin_Panels("1.0"),
RQ_SRS_Plugin_DataSourceSetupView_HTTPConnection_ServerAccess("1.0")
RQ_SRS_Plugin_DataSourceSetupView_HTTPConnection_ServerAccess("1.0"),
RQ_SRS_Plugin_DataSourceSetupView_HTTPConnection("1.0"),
)
@Name("data source setup")
def feature(self):
Expand Down
3 changes: 2 additions & 1 deletion tests/testflows/tests/automated/query_options.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ def max_data_points(self):


@TestScenario
@Requirements(RQ_SRS_Plugin_QueryOptions_MinInterval("1.0"))
@Requirements(RQ_SRS_Plugin_QueryOptions_MinInterval("1.0"),
RQ_SRS_Plugin_QueryOptions_Interval("1.0"))
def min_interval(self):
"""Check that grafana plugin supports specifying 'Min interval' textfield."""

Expand Down
12 changes: 9 additions & 3 deletions tests/testflows/tests/automated/sql_editor.py
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ def extrapolation_toggle(self):
for attempt in retries(delay=10, count=12):
with attempt:
with When("I click on run query button to see results with turned on extrapolation"):
panel.click_run_query_button()
panel.click_refresh_button()

with When("I take screenshot with extrapolation"):
panel.take_screenshot_for_visualization(screenshot_name='extrapolation_toggle_on')
Expand All @@ -339,7 +339,6 @@ def extrapolation_toggle(self):


@TestOutline
@Requirements(RQ_SRS_Plugin_RawSQLEditorInterface_SkipComments("1.0"))
def skip_comments_toggle(self, query):
"""Check that grafana plugin supports Skip Comments toggle."""

Expand Down Expand Up @@ -369,6 +368,7 @@ def skip_comments_toggle(self, query):


@TestScenario
@Requirements(RQ_SRS_Plugin_RawSQLEditorInterface_SkipComments("1.0"))
def multiline_comment(self):
"""Check that grafana plugin supports Skip Comments toggle with multiline comments."""

Expand All @@ -380,6 +380,7 @@ def multiline_comment(self):


@TestScenario
@Requirements(RQ_SRS_Plugin_RawSQLEditorInterface_SkipComments("1.0"))
def double_dash_comment(self):
"""Check that grafana plugin supports Skip Comments toggle with multiline comments."""

Expand All @@ -391,6 +392,7 @@ def double_dash_comment(self):


@TestScenario
@Requirements(RQ_SRS_Plugin_RawSQLEditorInterface_SkipComments("1.0"))
def hash_comment(self):
"""Check that grafana plugin supports Skip Comments toggle with multiline comments."""

Expand All @@ -402,6 +404,7 @@ def hash_comment(self):


@TestScenario
@Requirements(RQ_SRS_Plugin_RawSQLEditorInterface_SkipComments("1.0"))
def hash_exclamation_comment(self):
"""Check that grafana plugin supports Skip Comments toggle with multiline comments."""

Expand All @@ -415,7 +418,10 @@ def hash_exclamation_comment(self):
@TestFeature
@Requirements(
RQ_SRS_Plugin_RawSQLEditorInterface("1.0"),
RQ_SRS_Plugin_RawSQLEditorInterface_ShowGeneratedSQL("1.0")
RQ_SRS_Plugin_RawSQLEditorInterface_ShowGeneratedSQL("1.0"),
RQ_SRS_Plugin_QuerySetup("1.0"),
RQ_SRS_Plugin_QuerySettings("1.0"),
RQ_SRS_Plugin_RawSQLEditorInterface_SQLEditor("1.0")
)
@Name("sql editor")
def feature(self):
Expand Down

0 comments on commit 906e4a0

Please sign in to comment.