Skip to content

Commit

Permalink
FAB-16166 Switch to metadata.json for packaging
Browse files Browse the repository at this point in the history
The patch switches to using the new preferred name for the metadata
file.

Change-Id: I9f143c312c9367ac187868c7171ef458cfa21eaa
Signed-off-by: Jason Yellick <[email protected]>
  • Loading branch information
Jason Yellick authored and harrisob committed Aug 12, 2019
1 parent be1cb8b commit ee4052c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion fabric-client/lib/packager/Lifecycle.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ class LifecyclePackager extends BasePackager {
const descriptors = [];
const metadataDescriptor = {
bytes: Buffer.from(JSON.stringify(metadata), 'utf8'),
name: 'Chaincode-Package-Metadata.json'
name: 'metadata.json'
};
descriptors.push(metadataDescriptor);

Expand Down
10 changes: 5 additions & 5 deletions fabric-client/test/packager/ALifecycle.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,29 +39,29 @@ describe('Lifecycle Packager', () => {

it('should return the package when given all parameters', async () => {
const final_package = await lifecycle.finalPackage('name', 'v1', 'golang', Buffer.from('abc'), '/path');
expect(final_package.length).to.be.gt(200);
expect(final_package.length).to.be.gt(175);
});

it('should return the package when given all parameters but the path', async () => {
const final_package = await lifecycle.finalPackage('name', 'v1', 'golang', Buffer.from('abc'));
expect(final_package.length).to.be.gt(200);
expect(final_package.length).to.be.gt(175);
});
});

describe('#buildMetaDataDescriptors', () => {
it('should return a list of descriptors for the metadata without a path', async () => {
const descriptors = await lifecycle.buildMetaDataDescriptors('node');
expect(descriptors[0].name).to.equal('Chaincode-Package-Metadata.json');
expect(descriptors[0].name).to.equal('metadata.json');
});

it('should return a list of descriptors for the metadata with a path', async () => {
const descriptors = await lifecycle.buildMetaDataDescriptors('golang', '/path');
expect(descriptors[0].name).to.equal('Chaincode-Package-Metadata.json');
expect(descriptors[0].name).to.equal('metadata.json');
});

it('should return a list of descriptors for the metadata with no name and no path', async () => {
const descriptors = await lifecycle.buildMetaDataDescriptors();
expect(descriptors[0].name).to.equal('Chaincode-Package-Metadata.json');
expect(descriptors[0].name).to.equal('metadata.json');
});
});

Expand Down

0 comments on commit ee4052c

Please sign in to comment.