Skip to content

Commit

Permalink
need to revisit tar
Browse files Browse the repository at this point in the history
  • Loading branch information
joshspicer authored Aug 4, 2022
1 parent 0acc4d6 commit 07f4a48
Showing 1 changed file with 35 additions and 2 deletions.
37 changes: 35 additions & 2 deletions src/test/container-features/helpers.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ describe('validate processFeatureIdentifier', async function () {
assertFeatureIdInvariant(featureId);

assert.exists(featureSet);
assert.strictEqual(featureSet?.features[0].id, 'helloworld');
assert.strictEqual(featureSet?.features[0].id, 'ruby');
assert.deepEqual(featureSet?.sourceInformation, { type: 'direct-tarball', tarballUri: 'https://example.com/some/long/path/ruby.tgz' });
});

Expand Down Expand Up @@ -216,7 +216,40 @@ describe('validate processFeatureIdentifier', async function () {

it('should process oci registry (without tag)', async function () {
const feature: DevContainerFeature = {
id: 'ghcr.io/devcontainers/features/ruby',
id: 'ghcr.io/codspace/features/ruby',
options: {},
};

const featureSet = await processFeatureIdentifier(output, process.env, feature);
if (!featureSet) {
assert.fail('processFeatureIdentifier returned null');
}
const featureId = featureSet.features[0].id;
assertFeatureIdInvariant(featureId);
assert.strictEqual(featureSet?.features[0].id, 'ruby');

assert.exists(featureSet);

const expectedFeatureRef: OCIFeatureRef = {
id: 'ruby',
owner: 'devcontainers',
namespace: 'codspace/features',
registry: 'ghcr.io',
version: 'latest',
resource: 'ghcr.io/codspace/features'
};

if (featureSet.sourceInformation.type === 'oci') {
assert.ok(featureSet.sourceInformation.type === 'oci');
assert.deepEqual(featureSet.sourceInformation.featureRef, expectedFeatureRef);
} else {
assert.fail('sourceInformation.type is not oci');
}
});

it('should process oci registry (with a tag)', async function () {
const feature: DevContainerFeature = {
id: 'ghcr.io/devcontainers/features/ruby:1.0.10',
options: {},
};

Expand Down

0 comments on commit 07f4a48

Please sign in to comment.