Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(fargate): convert to posix paths before sending files to s3 #2431

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion packages/artillery/lib/platform/aws-ecs/legacy/bom.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,12 @@ const Table = require('cli-table3');

// NOTE: Code below presumes that all paths are absolute

//Tests in Fargate run on ubuntu, which uses posix paths
//This function converts a path to posix path, in case the original path was not posix (e.g. windows runs)
function _convertToPosixPath(p) {
return p.split(path.sep).join(path.posix.sep);
}

function createBOM(absoluteScriptPath, extraFiles, opts, callback) {
A.waterfall(
[
Expand Down Expand Up @@ -70,6 +76,7 @@ function createBOM(absoluteScriptPath, extraFiles, opts, callback) {
prefix = commonPrefix(context.localFilePaths);
}

prefix = _convertToPosixPath(prefix);
debug('prefix', prefix);

//
Expand Down Expand Up @@ -100,7 +107,15 @@ function createBOM(absoluteScriptPath, extraFiles, opts, callback) {
});

const files = context.localFilePaths.map((p) => {
return { orig: p, noPrefix: p.substring(prefix.length, p.length) };
return {
orig: p,
noPrefix: p.substring(prefix.length, p.length),
origPosix: _convertToPosixPath(p),
noPrefixPosix: _convertToPosixPath(p).substring(
prefix.length,
p.length
)
};
});

const pkgPath = _.find(files, (f) => {
Expand Down
6 changes: 3 additions & 3 deletions packages/artillery/lib/platform/aws-ecs/legacy/create-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ function syncS3(context, callback) {
return eachDone(null, context);
}

const key = context.s3Prefix + '/' + item.noPrefix;
const key = context.s3Prefix + '/' + item.noPrefixPosix;
plainS3.putObject(
{
Bucket: context.s3Bucket,
Expand Down Expand Up @@ -166,13 +166,13 @@ function writeTestMetadata(context, callback) {
const res = context.manifest.files.filter((o) => {
return o.orig === context.configPath;
});
const newConfigPath = res[0].noPrefix; // if we have been given a config, we must have an entry
const newConfigPath = res[0].noPrefixPosix; // if we have been given a config, we must have an entry
metadata.configPath = newConfigPath;
}

const newScriptPath = context.manifest.files.filter((o) => {
return o.orig === context.scriptPath;
})[0].noPrefix;
})[0].noPrefixPosix;
metadata.scriptPath = newScriptPath;

debug('metadata', metadata);
Expand Down
Loading