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 corner case of cluster subscribed to multiple versions of the sam… #1323

Merged
merged 2 commits into from
May 23, 2023
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
5 changes: 3 additions & 2 deletions app/apollo/test/channel.remote.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -691,7 +691,7 @@ describe('channel remote graphql test suite', () => {
},
],
},
}
},
});
console.log( `addSubscription result: ${JSON.stringify( result.data, null, 2 )}` );
const addSubscription = result.data.data.addSubscription;
Expand Down Expand Up @@ -723,7 +723,8 @@ describe('channel remote graphql test suite', () => {
expect(sub01).to.be.an('object');
expect(sub01.remote).to.be.an('object');
expect(sub01.remote.remoteType).to.equal('github');
expect(sub01.remote.parameters.length).to.equal(3); // One from the Config, one from the Version created with the channel, one from the new subscription
console.log( `PLC sub01.remote.parameters: ${JSON.stringify( sub01.remote.parameters, null, 2 )}` );
expect(sub01.remote.parameters.length).to.equal(2); // One from the Config merged with one from the Version
} catch (error) {
if (error.response) {
console.error('error encountered: ', error.response.data);
Expand Down
2 changes: 1 addition & 1 deletion app/utils/subscriptions.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ const getSubscriptionDetails = async(orgId, matchingSubscriptions, cluster) => {
else if( channel.contentType === CHANNEL_CONSTANTS.CONTENTTYPES.REMOTE ) {
sub.remote = {
remoteType: channel.remote.remoteType,
parameters: channel.remote.parameters || [],
parameters: channel.remote.parameters ? _.cloneDeep(channel.remote.parameters) : [], // cloning channel params prevents incorrect behavior if a cluster is subscribed to multiple versions of the same channel
};
// Find version (avoid using deprecated/ignored `versions` attribute on the channel)
const version = await models.DeployableVersion.findOne( { org_id: orgId, uuid: subscription.version_uuid } );
Expand Down