Skip to content

Commit

Permalink
Fixes
Browse files Browse the repository at this point in the history
Issue: ZENKO-4837
  • Loading branch information
williamlardier committed Oct 22, 2024
1 parent b091b97 commit ad9a00d
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 6 deletions.
25 changes: 19 additions & 6 deletions tests/ctst/steps/website/website.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,14 @@ Given('an index html file', async function (this: Zenko) {
});

When('the user puts the bucket website configuration', async function (this: Zenko) {
const bucketWebSiteConfiguration =
'<WebsiteConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">' +
'<IndexDocument><Suffix>string</Suffix></IndexDocument>';
const bucketWebSiteConfiguration = JSON.stringify({
IndexDocument: {
Suffix: 'index.html',
},
ErrorDocument: {
Key: 'error.html',
},
});

await S3.putBucketWebsite({
bucket: this.getSaved<string>('bucketName'),
Expand All @@ -31,7 +36,15 @@ When('the {string} endpoint is added to the overlay', async function (this: Zenk
Then('the user should be able to load the index.html file from the {string} endpoint',
async function (this: Zenko, endpoint: string) {
const uri = `http://${this.getSaved<string>('bucketName')}.${endpoint}`;
const response = await fetch(uri);
const content = await response.text();
assert.strictEqual(content.includes(pageMessage), true);
try {
const response = await fetch(uri);
const content = await response.text();
assert.strictEqual(content.includes(pageMessage), true);
} catch (err) {
this.logger.error('error when fetching the bucket website', {
err,
uri,
});
throw err;
}
});
16 changes: 16 additions & 0 deletions tests/ctst/world/Zenko.ts
Original file line number Diff line number Diff line change
Expand Up @@ -935,9 +935,25 @@ export default class Zenko extends World<ZenkoWorldParameters> {
};
try {
const response: AxiosResponse = await axiosInstance(axiosConfig);
this.logger.debug('Management API request', {
method,
path,
headers,
payload,
response: response.data,
statusCode: response.status,
});
return { statusCode: response.status, data: response.data as object };
/* eslint-disable */
} catch (err: any) {
this.logger.debug('Error when making management API request', {
method,
path,
headers,
payload,
err: err.response.data,
status: err.response.status,
});
return {
statusCode: err.response.status,
err: err.response.data,
Expand Down

0 comments on commit ad9a00d

Please sign in to comment.