Skip to content

Commit

Permalink
Remove unneeded endpoints from load test client, pull in existing loa…
Browse files Browse the repository at this point in the history
…d test dashboard
  • Loading branch information
pianohacker committed Aug 30, 2021
1 parent bdd45cf commit 1bc0237
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 17 deletions.
File renamed without changes.
12 changes: 0 additions & 12 deletions devenv/loadtest/modules/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,6 @@ export const DatasourcesEndpoint = class DatasourcesEndpoint {
update(id, payload) {
return this.httpClient.put(`/datasources/${id}`, JSON.stringify(payload));
}

delete(id) {
return this.httpClient.delete(`/datasources/${id}`);
}
};

export const DashboardsEndpoint = class DashboardsEndpoint {
Expand All @@ -42,10 +38,6 @@ export const DashboardsEndpoint = class DashboardsEndpoint {
upsert(payload) {
return this.httpClient.post(`/dashboards/db`, JSON.stringify(payload));
}

delete(id) {
return this.httpClient.delete(`/dashboards/uid/${id}`);
}
};

export const OrganizationsEndpoint = class OrganizationsEndpoint {
Expand All @@ -67,10 +59,6 @@ export const OrganizationsEndpoint = class OrganizationsEndpoint {
};
return this.httpClient.post(`/orgs`, JSON.stringify(payload));
}

delete(id) {
return this.httpClient.delete(`/orgs/${id}`);
}
};

export const UIEndpoint = class UIEndpoint {
Expand Down
4 changes: 2 additions & 2 deletions devenv/loadtest/modules/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ export const createTestOrgIfNotExists = (client) => {
return res.json().id;
};

export const upsertTestdataDatasource = (client) => {
export const upsertTestdataDatasource = (client, name) => {
const payload = {
access: 'proxy',
isDefault: false,
name: 'k6-image-renderer-testdata',
name,
type: 'testdata',
};

Expand Down
4 changes: 2 additions & 2 deletions devenv/loadtest/render_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export let options = {

let endpoint = __ENV.URL || 'http://localhost:3000';
const client = createClient(endpoint);
const dashboard = JSON.parse(open('fixtures/image-renderer-perf-dashboard.json'));
const dashboard = JSON.parse(open('fixtures/graph_panel.json'));

export const setup = () => {
let grafanaSession;
Expand All @@ -27,7 +27,7 @@ export const setup = () => {

const orgId = createTestOrgIfNotExists(client);
client.withOrgId(orgId);
upsertTestdataDatasource(client);
upsertTestdataDatasource(client, dashboard.panels[0].datasource);
upsertTestdataDashboard(client, dashboard);

return {
Expand Down
12 changes: 11 additions & 1 deletion devenv/loadtest/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,17 @@ run() {
done
shift $((OPTIND-1))

docker run -t --network=host -v $PWD:/src -e URL=$url --rm -i loadimpact/k6:master run --vus $vus --duration $duration $iterationsOption /src/render_test.js
docker run \
-it \
--network=host \
--mount type=bind,source=$PWD,destination=/src \
-e URL=$url \
--rm \
loadimpact/k6:master run \
--vus $vus \
--duration $duration \
$iterationsOption \
/src/render_test.js
}

run "$@"

0 comments on commit 1bc0237

Please sign in to comment.