Skip to content

Commit

Permalink
fix: if no component set to match against, skip checking server response
Browse files Browse the repository at this point in the history
  • Loading branch information
WillieRuemmele committed May 13, 2024
1 parent 2daff4e commit aac1d3d
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/client/metadataApiDeploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,9 @@ const buildFileResponsesFromComponentSet =
)
.concat(deleteNotFoundToFileResponses(cs)(responseMessages));

warnIfUnmatchedServerResult(fileResponses)(responseMessages);
if (cs.size) {
warnIfUnmatchedServerResult(fileResponses)(responseMessages);
}
return fileResponses;
};
/**
Expand Down
43 changes: 43 additions & 0 deletions test/client/metadataApiDeploy.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -880,6 +880,49 @@ describe('MetadataApiDeploy', () => {
warnSpy.restore();
emitSpy.restore();
});
it('should NOT warn when empty component set used', () => {
// everything is an emit. Warn calls emit, too.
const warnSpy = $$.SANDBOX.stub(Lifecycle.prototype, 'emitWarning');
const emitSpy = $$.SANDBOX.stub(Lifecycle.prototype, 'emit');

const component = matchingContentFile.COMPONENT;
const deployedSet = new ComponentSet([]);
const { fullName, type } = component;

const apiStatus: Partial<MetadataApiDeployStatus> = {
details: {
componentFailures: [
{
changed: 'true',
created: 'false',
deleted: 'false',
success: 'true',
fullName,
fileName: component.content,
componentType: type.name,
} as DeployMessage,
{
changed: 'false',
created: 'false',
deleted: 'true',
success: 'true',
fullName: 'myServerOnlyComponent',
fileName: 'myServerOnlyComponent',
componentType: type.name,
} as DeployMessage,
],
},
};
const result = new DeployResult(apiStatus as MetadataApiDeployStatus, deployedSet);

const responses = result.getFileResponses();

expect(responses).to.deep.equal([]);
expect(warnSpy.called).to.be.false;

warnSpy.restore();
emitSpy.restore();
});

it('should not report duplicates component', () => {
const component = matchingContentFile.COMPONENT;
Expand Down

2 comments on commit aac1d3d

@svc-cli-bot
Copy link
Collaborator

Choose a reason for hiding this comment

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

Benchmark

Benchmark suite Current: aac1d3d Previous: 847d40f Ratio
eda-componentSetCreate-linux 181 ms 187 ms 0.97
eda-sourceToMdapi-linux 1972 ms 1998 ms 0.99
eda-sourceToZip-linux 1446 ms 1409 ms 1.03
eda-mdapiToSource-linux 2890 ms 2804 ms 1.03
lotsOfClasses-componentSetCreate-linux 422 ms 416 ms 1.01
lotsOfClasses-sourceToMdapi-linux 3758 ms 3642 ms 1.03
lotsOfClasses-sourceToZip-linux 3117 ms 3047 ms 1.02
lotsOfClasses-mdapiToSource-linux 3502 ms 3462 ms 1.01
lotsOfClassesOneDir-componentSetCreate-linux 625 ms 628 ms 1.00
lotsOfClassesOneDir-sourceToMdapi-linux 6565 ms 6538 ms 1.00
lotsOfClassesOneDir-sourceToZip-linux 5613 ms 5663 ms 0.99
lotsOfClassesOneDir-mdapiToSource-linux 6343 ms 6301 ms 1.01

This comment was automatically generated by workflow using github-action-benchmark.

@svc-cli-bot
Copy link
Collaborator

Choose a reason for hiding this comment

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

Benchmark

Benchmark suite Current: aac1d3d Previous: 847d40f Ratio
eda-componentSetCreate-win32 410 ms 376 ms 1.09
eda-sourceToMdapi-win32 3582 ms 3502 ms 1.02
eda-sourceToZip-win32 2159 ms 2168 ms 1.00
eda-mdapiToSource-win32 5970 ms 5971 ms 1.00
lotsOfClasses-componentSetCreate-win32 843 ms 843 ms 1
lotsOfClasses-sourceToMdapi-win32 7672 ms 7518 ms 1.02
lotsOfClasses-sourceToZip-win32 5349 ms 4682 ms 1.14
lotsOfClasses-mdapiToSource-win32 7529 ms 7426 ms 1.01
lotsOfClassesOneDir-componentSetCreate-win32 1487 ms 1483 ms 1.00
lotsOfClassesOneDir-sourceToMdapi-win32 13976 ms 13813 ms 1.01
lotsOfClassesOneDir-sourceToZip-win32 8580 ms 8361 ms 1.03
lotsOfClassesOneDir-mdapiToSource-win32 13692 ms 13378 ms 1.02

This comment was automatically generated by workflow using github-action-benchmark.

Please sign in to comment.