Skip to content

Commit

Permalink
#730: fix failing exeute query test
Browse files Browse the repository at this point in the history
  • Loading branch information
JoernBerkefeld committed May 30, 2023
1 parent fc3286c commit 9c8ffd9
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 9 deletions.
6 changes: 3 additions & 3 deletions lib/metadataTypes/MetadataType.js
Original file line number Diff line number Diff line change
Expand Up @@ -1093,13 +1093,13 @@ class MetadataType {
try {
const response = await this.client.rest.post(uri, {}); // payload is empty for this request
if (response === 'OK') {
Util.logger.info(`Executed ${this.definition.type} key: ${key}`);
Util.logger.info(`Executed ${this.definition.type}: ${key}`);
} else {
throw new Error(`server response = (${response})`);
throw new Error(response);
}
return response;
} catch (ex) {
Util.logger.error(`Failed to start ${this.definition.type} ${key}: ${ex.message}`);
Util.logger.error(`Failed to execute ${this.definition.type} ${key}: ${ex.message}`);
}
}

Expand Down
15 changes: 11 additions & 4 deletions test/resourceFactory.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,15 +121,15 @@ exports.handleRESTRequest = async (config) => {
'resources',
config.headers.Authorization.replace('Bearer ', ''),
urlObj.pathname,
config.method + '-response.json'
config.method + '-response'
)
.replace(':', '_'); // replace : with _ for Windows

if (await fs.pathExists(testPath)) {
if (await fs.pathExists(testPath + '.json')) {
// build filter logic to ensure templating works
if (filterName) {
const response = JSON.parse(
await fs.readFile(testPath, {
await fs.readFile(testPath + '.json', {
encoding: 'utf8',
})
);
Expand All @@ -139,11 +139,18 @@ exports.handleRESTRequest = async (config) => {
} else {
return [
200,
await fs.readFile(testPath, {
await fs.readFile(testPath + '.json', {
encoding: 'utf8',
}),
];
}
} else if (await fs.pathExists(testPath + '.txt')) {
return [
200,
await fs.readFile(testPath + '.txt', {
encoding: 'utf8',
}),
];
} else {
/* eslint-disable no-console */
console.log(
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
OK

This file was deleted.

0 comments on commit 9c8ffd9

Please sign in to comment.