Release rolling / release (push) Successful in 9m39s
Peers live under Settings; Images is local-only. Registry is a top-level view with vault credentials, Hub search, and Registry API V2 catalog/tags/manifest/delete over the wire.
37 lines
1.1 KiB
JavaScript
37 lines
1.1 KiB
JavaScript
import test from 'brittle'
|
|
import { normalizeRegistryEndpoint } from '../server/services/registry-client.js'
|
|
|
|
test('normalizeRegistryEndpoint Docker Hub variants', (t) => {
|
|
const a = normalizeRegistryEndpoint('https://index.docker.io/v1/')
|
|
t.ok(a.isDockerHub)
|
|
t.is(a.baseUrl, 'https://registry-1.docker.io')
|
|
t.is(a.host, 'docker.io')
|
|
|
|
const b = normalizeRegistryEndpoint('docker.io')
|
|
t.ok(b.isDockerHub)
|
|
t.is(b.registryApiHost, 'registry-1.docker.io')
|
|
|
|
const c = normalizeRegistryEndpoint('')
|
|
t.ok(c.isDockerHub)
|
|
})
|
|
|
|
test('normalizeRegistryEndpoint private registry', (t) => {
|
|
const g = normalizeRegistryEndpoint('ghcr.io')
|
|
t.absent(g.isDockerHub)
|
|
t.is(g.baseUrl, 'https://ghcr.io')
|
|
t.is(g.host, 'ghcr.io')
|
|
|
|
const p = normalizeRegistryEndpoint('http://registry.local:5000')
|
|
t.is(p.baseUrl, 'http://registry.local:5000')
|
|
t.is(p.registryApiHost, 'registry.local:5000')
|
|
})
|
|
|
|
test('normalizeRegistryEndpoint rejects garbage', (t) => {
|
|
try {
|
|
normalizeRegistryEndpoint('http://[not-a-url')
|
|
t.fail('expected throw')
|
|
} catch (err) {
|
|
t.ok(/Invalid registry/i.test(err.message))
|
|
}
|
|
})
|