Skip to content

Commit

Permalink
Add runtime version metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanblock committed Nov 4, 2021
1 parent cad3b15 commit 5eb8e35
Show file tree
Hide file tree
Showing 3 changed files with 91 additions and 2 deletions.
File renamed without changes.
76 changes: 76 additions & 0 deletions cjs/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,81 @@ let runtimes = {
],
}

let runtimeVersions = {
'nodejs14.x': {
major: '14',
minor: null,
patch: null,
wildcard: '14.*.*'
},
'nodejs12.x': {
major: '12',
minor: null,
patch: null,
wildcard: '12.*.*',
},
'python3.9': {
major: '3',
minor: '9',
patch: null,
wildcard: '3.9.*',
},
'python3.8': {
major: '3',
minor: '8',
patch: null,
wildcard: '3.8.*',
},
'python3.7': {
major: '3',
minor: '7',
patch: null,
wildcard: '3.7.*',
},
'python3.6': {
major: '3',
minor: '6',
patch: null,
wildcard: '3.6.*',
},
'ruby2.7': {
major: '2',
minor: '7',
patch: null,
wildcard: '2.7.*',
},
'java11': {
major: '11',
minor: null,
patch: null,
wildcard: '11.*.*',
},
'java8.al2': {
major: '8',
minor: null,
patch: null,
wildcard: '8.*.*',
},
'java8': {
major: '8',
minor: null,
patch: null,
wildcard: '8.*.*',
},
'go1.x': {
major: '1',
minor: null,
patch: null,
wildcard: '1.*.*',
},
'dotnetcore3.1': {
major: '3',
minor: '1',
patch: null,
wildcard: '3.1.*',
},
}

let runtimeList = Object.values(runtimes).reduce((a, b) => a.concat(b), [])

let runtimesByArchitecture = {
Expand Down Expand Up @@ -110,6 +185,7 @@ let retiredRuntimes = {

module.exports = {
runtimes,
runtimeVersions,
runtimeList,
runtimesByArchitecture,
architecturesByRuntime,
Expand Down
17 changes: 15 additions & 2 deletions test/unit/esm/index-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,24 @@ test('Set up env', t => {
})

test('Exports', t => {
t.plan(7)
t.plan(8)
let {
runtimes,
runtimeVersions,
runtimeList,
runtimesByArchitecture,
architecturesByRuntime,
aliases,
retiredRuntimes,
} = lambdaRuntimes
t.ok(runtimes, 'Got runtimes')
t.ok(runtimeVersions, 'Got runtimeVersions')
t.ok(runtimeList, 'Got runtimeList')
t.ok(runtimesByArchitecture, 'Got runtimesByArchitecture')
t.ok(architecturesByRuntime, 'Got architecturesByRuntime')
t.ok(aliases, 'Got aliases')
t.ok(retiredRuntimes, 'Got retiredRuntimes')
t.equal(Object.keys(lambdaRuntimes).length, 6, 'Got all properties')
t.equal(Object.keys(lambdaRuntimes).length, 7, 'Got all properties')
console.dir(lambdaRuntimes, { depth: null })
})

Expand All @@ -35,6 +37,17 @@ test('runtimes semantics', t => {
t.pass('All runtimes values are arrays')
})

test('runtimeVersions semantics', t => {
t.plan(2)
let { runtimeList, runtimeVersions } = lambdaRuntimes
let list = runtimeList.filter(r => !r.startsWith('provided'))
list.forEach(runtime => {
if (!runtimeVersions[runtime]) t.fail(`${runtime} not found in runtimeVersions`)
})
t.pass('Found all runtimeVersions')
t.equal(list.length, Object.keys(runtimeVersions).length, 'Correct number of runtimeVersions found')
})

test('runtimeList semantics', t => {
t.plan(1)
let { runtimeList } = lambdaRuntimes
Expand Down

0 comments on commit 5eb8e35

Please sign in to comment.