Skip to content

Commit

Permalink
fix: 🐛 ignore parallelism of 1
Browse files Browse the repository at this point in the history
  • Loading branch information
joscha committed Oct 22, 2019
1 parent 16e4c61 commit f2645da
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 3 deletions.
28 changes: 28 additions & 0 deletions src/__tests__/__snapshots__/command.spec.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -389,6 +389,18 @@ subgraph cluster_0 {
"
`;

exports[`buildkite-graph Steps Command parallelism dot 2`] = `
"digraph \\"whatever\\" {
graph [ compound =true ];
subgraph cluster_0 {
graph [ color = \\"black\\" ];
\\"<noop>\\" [ color = \\"grey\\" ];
}
}
"
`;

exports[`buildkite-graph Steps Command parallelism json 1`] = `
Object {
"steps": Array [
Expand All @@ -400,13 +412,29 @@ Object {
}
`;

exports[`buildkite-graph Steps Command parallelism json 2`] = `
Object {
"steps": Array [
Object {
"command": "noop",
},
],
}
`;

exports[`buildkite-graph Steps Command parallelism yaml 1`] = `
"steps:
- command: noop
parallelism: 123
"
`;

exports[`buildkite-graph Steps Command parallelism yaml 2`] = `
"steps:
- command: noop
"
`;

exports[`buildkite-graph Steps Command plugins dot 1`] = `
"digraph \\"whatever\\" {
graph [ compound =true ];
Expand Down
7 changes: 5 additions & 2 deletions src/__tests__/command.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -185,13 +185,16 @@ describe('buildkite-graph', () => {
),
);

createTest('parallelism', () =>
createTest('parallelism', () => [
new Pipeline('whatever').add(
new CommandStep('noop')
.withParallelism(100)
.withParallelism(123),
),
);
new Pipeline('whatever').add(
new CommandStep('noop').withParallelism(1),
),
]);

createTest('plugins', () =>
new Pipeline('whatever').add(
Expand Down
2 changes: 1 addition & 1 deletion src/steps/command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ export class CommandStep extends LabeledStep {
command: transformCommand(this.command),
env: await (this.env as KeyValueImpl<this>).toJson(),
id: this._id,
parallelism: this.parallelism,
parallelism: this.parallelism === 1 ? undefined : this.parallelism,
concurrency: this.concurrency,
concurrency_group: this.concurrencyGroup,
artifact_paths: this._artifactPaths.size
Expand Down

1 comment on commit f2645da

@joscha
Copy link
Owner Author

@joscha joscha commented on f2645da Oct 22, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.