mirror of
https://github.com/grafana/grafana.git
synced 2025-07-31 08:12:10 +08:00

* Fix lint error in types.ts * Bump eslint and its deps to latest * Add eslintignore and remove not needed eslintrcs * Change webpack configs eslint config * Update package.jsons and removed unused eslintrc files * Chore yarn lint --fix 💅 * Add devenv to eslintignore * Remove eslint disable comments for rules that are not used * Remaining eslint fixes 💅 * Bump grafana/eslint-config 💥 * Modify package.json No need for duplicate checks. * Modify eslintignore to ignore data and dist folders * Revert removing .eslintrc to make sure not to use certain packages * Modify package.json to remove not needed command * Use gitignore for ignoring paths
36 lines
860 B
JavaScript
36 lines
860 B
JavaScript
export const createTestOrgIfNotExists = client => {
|
|
let orgId = 0;
|
|
let res = client.orgs.getByName('k6');
|
|
if (res.status === 404) {
|
|
res = client.orgs.create('k6');
|
|
if (res.status !== 200) {
|
|
throw new Error('Expected 200 response status when creating org');
|
|
}
|
|
orgId = res.json().orgId;
|
|
} else {
|
|
orgId = res.json().id;
|
|
}
|
|
|
|
client.withOrgId(orgId);
|
|
return orgId;
|
|
};
|
|
|
|
export const createTestdataDatasourceIfNotExists = client => {
|
|
const payload = {
|
|
access: 'proxy',
|
|
isDefault: false,
|
|
name: 'k6-testdata',
|
|
type: 'testdata',
|
|
};
|
|
|
|
let res = client.datasources.getByName(payload.name);
|
|
if (res.status === 404) {
|
|
res = client.datasources.create(payload);
|
|
if (res.status !== 200) {
|
|
throw new Error('Expected 200 response status when creating datasource');
|
|
}
|
|
}
|
|
|
|
return res.json().id;
|
|
};
|