-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Distroless images are also available with `*-distroless` tags; for example, v1 is available as `mattwebbio/orbital-sync:1-distroless`. These images are smaller and more secure than the default Alpine-based images, because they contain only the Orbital Sync code and its direct dependencies. They do not include a shell, package manager, or other tools that are typically present in a Linux distribution. These will be the default images in a future major version release.
- Loading branch information
1 parent
86b957c
commit a93c38e
Showing
6 changed files
with
169 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,41 +1,84 @@ | ||
import { Network } from 'testcontainers'; | ||
import { createOrbitalSyncContainer, createPiholeContainer } from '../containers'; | ||
import { | ||
OrbitalBaseImage, | ||
createOrbitalSyncContainer, | ||
createPiholeContainer | ||
} from '../containers'; | ||
import { inspectById } from '../docker'; | ||
import sleep from 'sleep-promise'; | ||
|
||
describe('Orbital', () => { | ||
it('should sync two targets and exit with "zero" exit code', async () => { | ||
const network = await new Network().start(); | ||
const [pihole1, pihole2, pihole3, orbitalImage] = await Promise.all([ | ||
createPiholeContainer({ password: 'primary' }).withNetwork(network).start(), | ||
createPiholeContainer({ password: 'secondary' }).withNetwork(network).start(), | ||
createPiholeContainer({ password: 'tertiary' }).withNetwork(network).start(), | ||
createOrbitalSyncContainer() | ||
]); | ||
|
||
const orbital = await orbitalImage | ||
.withEnvironment({ | ||
PRIMARY_HOST_BASE_URL: `http://${pihole1.getIpAddress(network.getName())}`, | ||
PRIMARY_HOST_PASSWORD: 'primary', | ||
SECONDARY_HOST_1_BASE_URL: `http://${pihole2.getIpAddress(network.getName())}`, | ||
SECONDARY_HOST_1_PASSWORD: 'secondary', | ||
SECONDARY_HOST_2_BASE_URL: `http://${pihole3.getIpAddress(network.getName())}`, | ||
SECONDARY_HOST_2_PASSWORD: 'tertiary', | ||
RUN_ONCE: 'true', | ||
VERBOSE: 'true' | ||
}) | ||
.withLogConsumer((stream) => stream.on('data', (chunk) => console.log(chunk))) | ||
.withNetwork(network) | ||
.start(); | ||
|
||
let orbitalStatus = await inspectById(orbital.getId()); | ||
while (orbitalStatus.State.Running) { | ||
await sleep(500); | ||
orbitalStatus = await inspectById(orbital.getId()); | ||
} | ||
|
||
await Promise.all([pihole1.stop(), pihole2.stop(), pihole3.stop()]); | ||
await network.stop(); | ||
expect(orbitalStatus.State.ExitCode).toBe(0); | ||
}, 300000); | ||
describe('Alpine', () => { | ||
it('should sync two targets and exit with "zero" exit code', async () => { | ||
const network = await new Network().start(); | ||
const [pihole1, pihole2, pihole3, orbitalImage] = await Promise.all([ | ||
createPiholeContainer({ password: 'primary' }).withNetwork(network).start(), | ||
createPiholeContainer({ password: 'secondary' }).withNetwork(network).start(), | ||
createPiholeContainer({ password: 'tertiary' }).withNetwork(network).start(), | ||
createOrbitalSyncContainer(OrbitalBaseImage.Alpine) | ||
]); | ||
|
||
const orbital = await orbitalImage | ||
.withEnvironment({ | ||
PRIMARY_HOST_BASE_URL: `http://${pihole1.getIpAddress(network.getName())}`, | ||
PRIMARY_HOST_PASSWORD: 'primary', | ||
SECONDARY_HOST_1_BASE_URL: `http://${pihole2.getIpAddress(network.getName())}`, | ||
SECONDARY_HOST_1_PASSWORD: 'secondary', | ||
SECONDARY_HOST_2_BASE_URL: `http://${pihole3.getIpAddress(network.getName())}`, | ||
SECONDARY_HOST_2_PASSWORD: 'tertiary', | ||
RUN_ONCE: 'true', | ||
VERBOSE: 'true' | ||
}) | ||
.withLogConsumer((stream) => stream.on('data', (chunk) => console.log(chunk))) | ||
.withNetwork(network) | ||
.start(); | ||
|
||
let orbitalStatus = await inspectById(orbital.getId()); | ||
while (orbitalStatus.State.Running) { | ||
await sleep(500); | ||
orbitalStatus = await inspectById(orbital.getId()); | ||
} | ||
|
||
await Promise.all([pihole1.stop(), pihole2.stop(), pihole3.stop()]); | ||
await network.stop(); | ||
expect(orbitalStatus.State.ExitCode).toBe(0); | ||
}, 300000); | ||
}); | ||
|
||
describe('Distroless', () => { | ||
it('should sync two targets and exit with "zero" exit code', async () => { | ||
const network = await new Network().start(); | ||
const [pihole1, pihole2, pihole3, orbitalImage] = await Promise.all([ | ||
createPiholeContainer({ password: 'primary' }).withNetwork(network).start(), | ||
createPiholeContainer({ password: 'secondary' }).withNetwork(network).start(), | ||
createPiholeContainer({ password: 'tertiary' }).withNetwork(network).start(), | ||
createOrbitalSyncContainer(OrbitalBaseImage.Distroless) | ||
]); | ||
|
||
const orbital = await orbitalImage | ||
.withEnvironment({ | ||
PRIMARY_HOST_BASE_URL: `http://${pihole1.getIpAddress(network.getName())}`, | ||
PRIMARY_HOST_PASSWORD: 'primary', | ||
SECONDARY_HOST_1_BASE_URL: `http://${pihole2.getIpAddress(network.getName())}`, | ||
SECONDARY_HOST_1_PASSWORD: 'secondary', | ||
SECONDARY_HOST_2_BASE_URL: `http://${pihole3.getIpAddress(network.getName())}`, | ||
SECONDARY_HOST_2_PASSWORD: 'tertiary', | ||
RUN_ONCE: 'true', | ||
VERBOSE: 'true' | ||
}) | ||
.withLogConsumer((stream) => stream.on('data', (chunk) => console.log(chunk))) | ||
.withNetwork(network) | ||
.start(); | ||
|
||
let orbitalStatus = await inspectById(orbital.getId()); | ||
while (orbitalStatus.State.Running) { | ||
await sleep(500); | ||
orbitalStatus = await inspectById(orbital.getId()); | ||
} | ||
|
||
await Promise.all([pihole1.stop(), pihole2.stop(), pihole3.stop()]); | ||
await network.stop(); | ||
expect(orbitalStatus.State.ExitCode).toBe(0); | ||
}, 300000); | ||
}); | ||
}); |