2019-08-23 09:16:36 +00:00
|
|
|
import { assert, expect } from 'chai';
|
2019-11-12 17:02:03 +00:00
|
|
|
import { SinonStub, stub } from 'sinon';
|
2019-08-23 09:16:36 +00:00
|
|
|
|
2019-11-12 17:02:03 +00:00
|
|
|
import { child_process } from 'mz';
|
2019-08-28 10:38:50 +00:00
|
|
|
import * as semver from 'semver';
|
2019-08-23 09:16:36 +00:00
|
|
|
|
|
|
|
import * as constants from '../src/lib/constants';
|
2019-08-28 10:38:50 +00:00
|
|
|
import {
|
|
|
|
containerContractsFulfilled,
|
2020-04-07 11:22:56 +00:00
|
|
|
intialiseContractRequirements,
|
2019-08-28 10:38:50 +00:00
|
|
|
validateContract,
|
|
|
|
} from '../src/lib/contracts';
|
2019-08-23 09:16:36 +00:00
|
|
|
import * as osRelease from '../src/lib/os-release';
|
|
|
|
import supervisorVersion = require('../src/lib/supervisor-version');
|
|
|
|
|
|
|
|
describe('Container contracts', () => {
|
2019-11-12 17:02:03 +00:00
|
|
|
before(() => {
|
2020-04-07 11:22:56 +00:00
|
|
|
intialiseContractRequirements({
|
2020-09-23 19:23:33 +00:00
|
|
|
supervisorVersion,
|
2020-04-07 11:22:56 +00:00
|
|
|
deviceType: 'intel-nuc',
|
|
|
|
l4tVersion: '32.2',
|
|
|
|
});
|
2019-11-12 17:02:03 +00:00
|
|
|
});
|
|
|
|
|
2019-08-28 10:38:50 +00:00
|
|
|
describe('Contract validation', () => {
|
2019-11-12 17:02:03 +00:00
|
|
|
it('should correctly validate a contract with no requirements', () =>
|
2020-04-07 11:22:56 +00:00
|
|
|
expect(() =>
|
2019-08-28 10:38:50 +00:00
|
|
|
validateContract({
|
|
|
|
slug: 'user-container',
|
|
|
|
}),
|
2020-04-07 11:22:56 +00:00
|
|
|
).to.be.not.throw());
|
2019-08-23 09:16:36 +00:00
|
|
|
|
2019-11-12 17:02:03 +00:00
|
|
|
it('should correctly validate a contract with extra fields', () =>
|
2020-04-07 11:22:56 +00:00
|
|
|
expect(() =>
|
2019-08-28 10:38:50 +00:00
|
|
|
validateContract({
|
2019-08-23 09:16:36 +00:00
|
|
|
slug: 'user-container',
|
|
|
|
name: 'user-container',
|
2019-08-28 10:38:50 +00:00
|
|
|
version: '3.0.0',
|
|
|
|
}),
|
2020-04-07 11:22:56 +00:00
|
|
|
).to.be.not.throw());
|
2019-08-23 09:16:36 +00:00
|
|
|
|
2019-08-28 10:38:50 +00:00
|
|
|
it('should not validate a contract without the minimum required fields', () => {
|
2019-11-12 17:02:03 +00:00
|
|
|
return Promise.all([
|
2020-04-07 11:22:56 +00:00
|
|
|
expect(() => validateContract({})).to.throw(),
|
|
|
|
expect(() => validateContract({ name: 'test' })).to.throw(),
|
|
|
|
expect(() => validateContract({ requires: [] })).to.throw(),
|
2019-11-12 17:02:03 +00:00
|
|
|
]);
|
2019-08-28 10:38:50 +00:00
|
|
|
});
|
2019-08-23 09:16:36 +00:00
|
|
|
|
2019-11-12 17:02:03 +00:00
|
|
|
it('should correctly validate a contract with requirements', () =>
|
2020-04-07 11:22:56 +00:00
|
|
|
expect(() =>
|
2019-08-28 10:38:50 +00:00
|
|
|
validateContract({
|
2019-08-23 09:16:36 +00:00
|
|
|
slug: 'user-container',
|
|
|
|
requires: [
|
|
|
|
{
|
2019-11-12 17:02:03 +00:00
|
|
|
type: 'sw.l4t',
|
|
|
|
version: '32.2',
|
2019-08-23 09:16:36 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
type: 'sw.supervisor',
|
|
|
|
},
|
|
|
|
],
|
2019-08-28 10:38:50 +00:00
|
|
|
}),
|
2020-04-07 11:22:56 +00:00
|
|
|
).to.not.throw());
|
2019-08-28 10:38:50 +00:00
|
|
|
|
|
|
|
it('should not validate a contract with requirements without the minimum required fields', () => {
|
2020-04-07 11:22:56 +00:00
|
|
|
return expect(() =>
|
2019-08-28 10:38:50 +00:00
|
|
|
validateContract({
|
|
|
|
slug: 'user-container',
|
2019-08-23 09:16:36 +00:00
|
|
|
requires: [
|
|
|
|
{
|
2019-08-28 10:38:50 +00:00
|
|
|
version: '>3.0.0',
|
2019-08-23 09:16:36 +00:00
|
|
|
},
|
|
|
|
],
|
2019-08-28 10:38:50 +00:00
|
|
|
}),
|
2020-04-07 11:22:56 +00:00
|
|
|
).to.throw();
|
2019-08-28 10:38:50 +00:00
|
|
|
});
|
2019-08-23 09:16:36 +00:00
|
|
|
});
|
|
|
|
|
2019-08-28 10:38:50 +00:00
|
|
|
describe('Requirement resolution', () => {
|
|
|
|
// Because the supervisor version will change whenever the
|
|
|
|
// package.json will, we generate values which are above
|
|
|
|
// and below the current value, and use these to reason
|
|
|
|
// about the contract engine results
|
2020-05-15 11:01:51 +00:00
|
|
|
const supervisorVersionGreater = `${
|
|
|
|
semver.major(supervisorVersion)! + 1
|
|
|
|
}.0.0`;
|
|
|
|
const supervisorVersionLesser = `${
|
|
|
|
semver.major(supervisorVersion)! - 1
|
|
|
|
}.0.0`;
|
2019-08-28 10:38:50 +00:00
|
|
|
|
|
|
|
before(async () => {
|
|
|
|
// We ensure that the versions we're using for testing
|
|
|
|
// are the same as the time of implementation, otherwise
|
|
|
|
// these tests could fail or succeed when they shouldn't
|
|
|
|
expect(await osRelease.getOSSemver(constants.hostOSVersionPath)).to.equal(
|
|
|
|
'2.0.6',
|
|
|
|
);
|
|
|
|
assert(semver.gt(supervisorVersionGreater, supervisorVersion));
|
|
|
|
assert(semver.lt(supervisorVersionLesser, supervisorVersion));
|
|
|
|
});
|
|
|
|
|
|
|
|
it('Should correctly run containers with no requirements', async () => {
|
|
|
|
expect(
|
2020-04-07 11:22:56 +00:00
|
|
|
containerContractsFulfilled({
|
2019-08-28 10:38:50 +00:00
|
|
|
service: {
|
2019-10-29 11:56:40 +00:00
|
|
|
contract: {
|
|
|
|
type: 'sw.container',
|
|
|
|
slug: 'user-container',
|
|
|
|
},
|
|
|
|
optional: false,
|
2019-08-28 10:38:50 +00:00
|
|
|
},
|
|
|
|
}),
|
|
|
|
)
|
|
|
|
.to.have.property('valid')
|
|
|
|
.that.equals(true);
|
|
|
|
expect(
|
2020-04-07 11:22:56 +00:00
|
|
|
containerContractsFulfilled({
|
2019-08-28 10:38:50 +00:00
|
|
|
service: {
|
2019-10-29 11:56:40 +00:00
|
|
|
contract: {
|
|
|
|
type: 'sw.container',
|
|
|
|
slug: 'user-container1',
|
|
|
|
},
|
|
|
|
optional: false,
|
2019-08-28 10:38:50 +00:00
|
|
|
},
|
|
|
|
service2: {
|
2019-10-29 11:56:40 +00:00
|
|
|
contract: {
|
|
|
|
type: 'sw.container',
|
|
|
|
slug: 'user-container2',
|
|
|
|
},
|
|
|
|
optional: false,
|
2019-08-28 10:38:50 +00:00
|
|
|
},
|
|
|
|
}),
|
|
|
|
)
|
|
|
|
.to.have.property('valid')
|
|
|
|
.that.equals(true);
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should correctly run containers whose requirements are satisfied', async () => {
|
|
|
|
expect(
|
2020-04-07 11:22:56 +00:00
|
|
|
containerContractsFulfilled({
|
2019-08-28 10:38:50 +00:00
|
|
|
service: {
|
2019-10-29 11:56:40 +00:00
|
|
|
contract: {
|
|
|
|
type: 'sw.container',
|
|
|
|
name: 'user-container',
|
|
|
|
slug: 'user-container',
|
|
|
|
requires: [
|
|
|
|
{
|
2019-11-12 17:02:03 +00:00
|
|
|
type: 'sw.supervisor',
|
|
|
|
version: `>${supervisorVersionLesser}`,
|
2019-10-29 11:56:40 +00:00
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
optional: false,
|
2019-08-28 10:38:50 +00:00
|
|
|
},
|
|
|
|
}),
|
|
|
|
)
|
|
|
|
.to.have.property('valid')
|
|
|
|
.that.equals(true);
|
|
|
|
|
|
|
|
expect(
|
2020-04-07 11:22:56 +00:00
|
|
|
containerContractsFulfilled({
|
2019-08-28 10:38:50 +00:00
|
|
|
service: {
|
2019-10-29 11:56:40 +00:00
|
|
|
contract: {
|
|
|
|
type: 'sw.container',
|
|
|
|
name: 'user-container',
|
|
|
|
slug: 'user-container',
|
|
|
|
requires: [
|
|
|
|
{
|
|
|
|
type: 'sw.supervisor',
|
|
|
|
version: `<${supervisorVersionGreater}`,
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
optional: false,
|
2019-08-28 10:38:50 +00:00
|
|
|
},
|
|
|
|
}),
|
|
|
|
)
|
|
|
|
.to.have.property('valid')
|
|
|
|
.that.equals(true);
|
|
|
|
|
|
|
|
expect(
|
2020-04-07 11:22:56 +00:00
|
|
|
containerContractsFulfilled({
|
2019-08-28 10:38:50 +00:00
|
|
|
service: {
|
2019-10-29 11:56:40 +00:00
|
|
|
contract: {
|
|
|
|
type: 'sw.container',
|
|
|
|
name: 'user-container',
|
|
|
|
slug: 'user-container',
|
|
|
|
requires: [
|
|
|
|
{
|
|
|
|
type: 'sw.supervisor',
|
|
|
|
version: `>${supervisorVersionLesser}`,
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
optional: false,
|
2019-08-28 10:38:50 +00:00
|
|
|
},
|
|
|
|
}),
|
|
|
|
)
|
|
|
|
.to.have.property('valid')
|
|
|
|
.that.equals(true);
|
|
|
|
|
|
|
|
expect(
|
2020-04-07 11:22:56 +00:00
|
|
|
containerContractsFulfilled({
|
2019-08-28 10:38:50 +00:00
|
|
|
service: {
|
2019-10-29 11:56:40 +00:00
|
|
|
contract: {
|
|
|
|
type: 'sw.container',
|
|
|
|
name: 'user-container',
|
|
|
|
slug: 'user-container',
|
|
|
|
requires: [
|
|
|
|
{
|
|
|
|
type: 'sw.supervisor',
|
|
|
|
version: `>${supervisorVersionLesser}`,
|
|
|
|
},
|
|
|
|
{
|
2019-11-12 17:02:03 +00:00
|
|
|
type: 'sw.l4t',
|
|
|
|
version: '32.2',
|
2019-10-29 11:56:40 +00:00
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
optional: false,
|
2019-08-28 10:38:50 +00:00
|
|
|
},
|
|
|
|
}),
|
|
|
|
)
|
|
|
|
.to.have.property('valid')
|
|
|
|
.that.equals(true);
|
2020-09-23 19:23:33 +00:00
|
|
|
|
2019-08-28 10:38:50 +00:00
|
|
|
expect(
|
2020-04-07 11:22:56 +00:00
|
|
|
containerContractsFulfilled({
|
2019-08-28 10:38:50 +00:00
|
|
|
service: {
|
2019-10-29 11:56:40 +00:00
|
|
|
contract: {
|
|
|
|
type: 'sw.container',
|
|
|
|
name: 'user-container1',
|
|
|
|
slug: 'user-container1',
|
|
|
|
requires: [
|
|
|
|
{
|
|
|
|
type: 'sw.supervisor',
|
|
|
|
version: `>${supervisorVersionLesser}`,
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
optional: false,
|
2019-08-28 10:38:50 +00:00
|
|
|
},
|
|
|
|
service2: {
|
2019-10-29 11:56:40 +00:00
|
|
|
contract: {
|
|
|
|
type: 'sw.container',
|
|
|
|
name: 'user-container1',
|
|
|
|
slug: 'user-container1',
|
|
|
|
requires: [
|
|
|
|
{
|
|
|
|
type: 'sw.os',
|
|
|
|
version: '<3.0.0',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
optional: false,
|
2019-08-28 10:38:50 +00:00
|
|
|
},
|
|
|
|
}),
|
|
|
|
)
|
|
|
|
.to.have.property('valid')
|
|
|
|
.that.equals(true);
|
|
|
|
});
|
|
|
|
|
|
|
|
it('Should refuse to run containers whose requirements are not satisfied', async () => {
|
2020-04-07 11:22:56 +00:00
|
|
|
let fulfilled = containerContractsFulfilled({
|
2019-08-28 10:38:50 +00:00
|
|
|
service: {
|
2019-10-29 11:56:40 +00:00
|
|
|
contract: {
|
|
|
|
type: 'sw.container',
|
|
|
|
name: 'user-container',
|
|
|
|
slug: 'user-container',
|
|
|
|
requires: [
|
|
|
|
{
|
2019-11-12 17:02:03 +00:00
|
|
|
type: 'sw.supervisor',
|
|
|
|
version: `>=${supervisorVersionGreater}`,
|
2019-10-29 11:56:40 +00:00
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
optional: false,
|
2019-08-23 09:16:36 +00:00
|
|
|
},
|
2019-08-28 10:38:50 +00:00
|
|
|
});
|
2020-05-15 11:01:51 +00:00
|
|
|
expect(fulfilled).to.have.property('valid').that.equals(false);
|
2019-08-28 10:38:50 +00:00
|
|
|
expect(fulfilled)
|
|
|
|
.to.have.property('unmetServices')
|
|
|
|
.that.deep.equals(['service']);
|
|
|
|
|
2020-04-07 11:22:56 +00:00
|
|
|
fulfilled = containerContractsFulfilled({
|
2019-08-28 10:38:50 +00:00
|
|
|
service2: {
|
2019-10-29 11:56:40 +00:00
|
|
|
contract: {
|
|
|
|
type: 'sw.container',
|
|
|
|
name: 'user-container2',
|
|
|
|
slug: 'user-container2',
|
|
|
|
requires: [
|
|
|
|
{
|
2019-11-12 17:02:03 +00:00
|
|
|
type: 'sw.l4t',
|
|
|
|
version: '28.2',
|
2019-10-29 11:56:40 +00:00
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
optional: false,
|
2019-08-23 09:16:36 +00:00
|
|
|
},
|
2019-08-28 10:38:50 +00:00
|
|
|
});
|
2020-05-15 11:01:51 +00:00
|
|
|
expect(fulfilled).to.have.property('valid').that.equals(false);
|
2019-08-28 10:38:50 +00:00
|
|
|
expect(fulfilled)
|
|
|
|
.to.have.property('unmetServices')
|
|
|
|
.that.deep.equals(['service2']);
|
|
|
|
|
2020-04-07 11:22:56 +00:00
|
|
|
fulfilled = containerContractsFulfilled({
|
2019-08-28 10:38:50 +00:00
|
|
|
service: {
|
2019-10-29 11:56:40 +00:00
|
|
|
contract: {
|
|
|
|
type: 'sw.container',
|
|
|
|
name: 'user-container1',
|
|
|
|
slug: 'user-container1',
|
|
|
|
requires: [
|
|
|
|
{
|
|
|
|
type: 'sw.supervisor',
|
|
|
|
version: `>=${supervisorVersionLesser}`,
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
optional: false,
|
2019-08-23 09:16:36 +00:00
|
|
|
},
|
2019-08-28 10:38:50 +00:00
|
|
|
service2: {
|
2019-10-29 11:56:40 +00:00
|
|
|
contract: {
|
|
|
|
type: 'sw.container',
|
|
|
|
name: 'user-container2',
|
|
|
|
slug: 'user-container2',
|
|
|
|
requires: [
|
|
|
|
{
|
|
|
|
type: 'sw.supervisor',
|
|
|
|
version: `<=${supervisorVersionLesser}`,
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
optional: false,
|
2019-08-23 09:16:36 +00:00
|
|
|
},
|
2019-08-28 10:38:50 +00:00
|
|
|
});
|
2020-05-15 11:01:51 +00:00
|
|
|
expect(fulfilled).to.have.property('valid').that.equals(false);
|
2019-08-28 10:38:50 +00:00
|
|
|
expect(fulfilled)
|
|
|
|
.to.have.property('unmetServices')
|
|
|
|
.that.deep.equals(['service2']);
|
|
|
|
});
|
2019-10-29 11:56:40 +00:00
|
|
|
|
|
|
|
describe('Optional containers', () => {
|
|
|
|
it('should correctly run passing optional containers', async () => {
|
|
|
|
const {
|
|
|
|
valid,
|
|
|
|
unmetServices,
|
|
|
|
fulfilledServices,
|
2020-04-07 11:22:56 +00:00
|
|
|
} = containerContractsFulfilled({
|
2019-10-29 11:56:40 +00:00
|
|
|
service1: {
|
|
|
|
contract: {
|
|
|
|
type: 'sw.container',
|
|
|
|
slug: 'service1',
|
|
|
|
requires: [
|
|
|
|
{
|
2019-11-12 17:02:03 +00:00
|
|
|
type: 'sw.supervisor',
|
2019-10-29 11:56:40 +00:00
|
|
|
version: `<${supervisorVersionGreater}`,
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
optional: true,
|
|
|
|
},
|
|
|
|
});
|
|
|
|
expect(valid).to.equal(true);
|
|
|
|
expect(unmetServices).to.deep.equal([]);
|
|
|
|
expect(fulfilledServices).to.deep.equal(['service1']);
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should corrrectly omit failing optional containers', async () => {
|
|
|
|
const {
|
|
|
|
valid,
|
|
|
|
unmetServices,
|
|
|
|
fulfilledServices,
|
2020-04-07 11:22:56 +00:00
|
|
|
} = containerContractsFulfilled({
|
2019-10-29 11:56:40 +00:00
|
|
|
service1: {
|
|
|
|
contract: {
|
|
|
|
type: 'sw.container',
|
|
|
|
slug: 'service1',
|
|
|
|
requires: [
|
|
|
|
{
|
2019-11-12 17:02:03 +00:00
|
|
|
type: 'sw.supervisor',
|
2019-10-29 11:56:40 +00:00
|
|
|
version: `>${supervisorVersionGreater}`,
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
optional: true,
|
|
|
|
},
|
|
|
|
service2: {
|
|
|
|
contract: {
|
|
|
|
type: 'sw.container',
|
|
|
|
slug: 'service2',
|
|
|
|
},
|
|
|
|
optional: false,
|
|
|
|
},
|
|
|
|
});
|
|
|
|
expect(valid).to.equal(true);
|
|
|
|
expect(unmetServices).to.deep.equal(['service1']);
|
|
|
|
expect(fulfilledServices).to.deep.equal(['service2']);
|
|
|
|
});
|
|
|
|
});
|
2019-08-23 09:16:36 +00:00
|
|
|
});
|
|
|
|
});
|
2019-11-12 17:02:03 +00:00
|
|
|
|
|
|
|
describe('L4T version detection', () => {
|
2020-03-06 10:28:23 +00:00
|
|
|
let execStub: SinonStub;
|
2019-11-12 17:02:03 +00:00
|
|
|
|
2020-03-06 10:28:23 +00:00
|
|
|
const seedExec = (version: string) => {
|
|
|
|
execStub = stub(child_process, 'exec').returns(
|
|
|
|
Promise.resolve([Buffer.from(version), Buffer.from('')]),
|
|
|
|
);
|
|
|
|
};
|
2019-11-12 17:02:03 +00:00
|
|
|
|
2020-03-06 10:28:23 +00:00
|
|
|
afterEach(() => {
|
2019-11-12 17:02:03 +00:00
|
|
|
execStub.restore();
|
2020-03-06 10:28:23 +00:00
|
|
|
});
|
2019-11-12 17:02:03 +00:00
|
|
|
|
2020-03-06 10:28:23 +00:00
|
|
|
it('should correctly parse L4T version strings', async () => {
|
|
|
|
seedExec('4.9.140-l4t-r32.2+g3dcbed5');
|
|
|
|
expect(await osRelease.getL4tVersion()).to.equal('32.2.0');
|
2019-11-12 17:02:03 +00:00
|
|
|
expect(execStub.callCount).to.equal(1);
|
|
|
|
execStub.restore();
|
2020-03-06 10:28:23 +00:00
|
|
|
|
|
|
|
seedExec('4.4.38-l4t-r28.2+g174510d');
|
|
|
|
expect(await osRelease.getL4tVersion()).to.equal('28.2.0');
|
|
|
|
expect(execStub.callCount).to.equal(1);
|
2019-11-12 17:02:03 +00:00
|
|
|
});
|
|
|
|
|
2020-03-06 10:28:23 +00:00
|
|
|
it('should correctly handle l4t versions which contain three numbers', async () => {
|
|
|
|
seedExec('4.4.38-l4t-r32.3.1+g174510d');
|
|
|
|
expect(await osRelease.getL4tVersion()).to.equal('32.3.1');
|
|
|
|
expect(execStub.callCount).to.equal(1);
|
|
|
|
});
|
2019-11-12 17:02:03 +00:00
|
|
|
|
2020-03-06 10:28:23 +00:00
|
|
|
it('should return undefined when there is no l4t string in uname', async () => {
|
|
|
|
seedExec('4.18.14-yocto-standard');
|
2019-11-12 17:02:03 +00:00
|
|
|
expect(await osRelease.getL4tVersion()).to.be.undefined;
|
2020-03-06 10:28:23 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
describe('L4T comparison', () => {
|
2020-04-07 11:22:56 +00:00
|
|
|
const seedEngine = async (version: string) => {
|
|
|
|
if (execStub != null) {
|
|
|
|
execStub.restore();
|
|
|
|
}
|
|
|
|
seedExec(version);
|
|
|
|
intialiseContractRequirements({
|
2020-09-23 19:23:33 +00:00
|
|
|
supervisorVersion,
|
2020-04-07 11:22:56 +00:00
|
|
|
deviceType: 'intel-nuc',
|
|
|
|
l4tVersion: await osRelease.getL4tVersion(),
|
|
|
|
});
|
|
|
|
};
|
|
|
|
|
2020-03-06 10:28:23 +00:00
|
|
|
it('should allow semver matching even when l4t does not fulfill semver', async () => {
|
2020-04-07 11:22:56 +00:00
|
|
|
await seedEngine('4.4.38-l4t-r31.0');
|
2020-03-06 10:28:23 +00:00
|
|
|
|
|
|
|
expect(
|
2020-04-07 11:22:56 +00:00
|
|
|
containerContractsFulfilled({
|
2020-03-06 10:28:23 +00:00
|
|
|
service: {
|
|
|
|
contract: {
|
|
|
|
type: 'sw.container',
|
|
|
|
slug: 'user-container',
|
|
|
|
requires: [
|
|
|
|
{
|
|
|
|
type: 'sw.l4t',
|
|
|
|
version: '>=31.0.0',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
optional: false,
|
|
|
|
},
|
|
|
|
}),
|
|
|
|
)
|
|
|
|
.to.have.property('valid')
|
|
|
|
.that.equals(true);
|
|
|
|
|
|
|
|
expect(
|
2020-04-07 11:22:56 +00:00
|
|
|
containerContractsFulfilled({
|
2020-03-06 10:28:23 +00:00
|
|
|
service: {
|
|
|
|
contract: {
|
|
|
|
type: 'sw.container',
|
|
|
|
slug: 'user-container',
|
|
|
|
requires: [
|
|
|
|
{
|
|
|
|
type: 'sw.l4t',
|
|
|
|
version: '<31.0.0',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
optional: false,
|
|
|
|
},
|
|
|
|
}),
|
|
|
|
)
|
|
|
|
.to.have.property('valid')
|
|
|
|
.that.equals(false);
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should allow semver matching when l4t does fulfill semver', async () => {
|
2020-04-07 11:22:56 +00:00
|
|
|
await seedEngine('4.4.38-l4t-r31.0.1');
|
2020-03-06 10:28:23 +00:00
|
|
|
|
|
|
|
expect(
|
2020-04-07 11:22:56 +00:00
|
|
|
containerContractsFulfilled({
|
2020-03-06 10:28:23 +00:00
|
|
|
service: {
|
|
|
|
contract: {
|
|
|
|
type: 'sw.container',
|
|
|
|
slug: 'user-container',
|
|
|
|
requires: [
|
|
|
|
{
|
|
|
|
type: 'sw.l4t',
|
|
|
|
version: '>=31.0.0',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
optional: false,
|
|
|
|
},
|
|
|
|
}),
|
|
|
|
)
|
|
|
|
.to.have.property('valid')
|
|
|
|
.that.equals(true);
|
|
|
|
|
|
|
|
expect(
|
2020-04-07 11:22:56 +00:00
|
|
|
containerContractsFulfilled({
|
2020-03-06 10:28:23 +00:00
|
|
|
service: {
|
|
|
|
contract: {
|
|
|
|
type: 'sw.container',
|
|
|
|
slug: 'user-container',
|
|
|
|
requires: [
|
|
|
|
{
|
|
|
|
type: 'sw.l4t',
|
|
|
|
version: '<31.0.0',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
optional: false,
|
|
|
|
},
|
|
|
|
}),
|
|
|
|
)
|
|
|
|
.to.have.property('valid')
|
|
|
|
.that.equals(false);
|
|
|
|
});
|
2019-11-12 17:02:03 +00:00
|
|
|
});
|
|
|
|
});
|