File: container.bats

package info (click to toggle)
golang-github-containers-storage 1.24.8%2Bdfsg1-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 3,324 kB
  • sloc: sh: 812; ansic: 319; makefile: 175; awk: 12
file content (36 lines) | stat: -rw-r--r-- 1,022 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/usr/bin/env bats

load helpers

@test "container" {
	# Create and populate three interesting layers.
	populate

	# Create an image using to top layer.
	run storage --debug=false create-image $upperlayer
	[ "$status" -eq 0 ]
	[ "$output" != "" ]
	image=${output%%   *}

	# Create a container using the image.
	name=wonderful-container
	run storage --debug=false create-container --name $name $image
	[ "$status" -eq 0 ]
	[ "$output" != "" ]
	container=${lines[0]}

	# Add a couple of big data items.
	createrandom ${TESTDIR}/random1
	createrandom ${TESTDIR}/random2
	storage set-container-data -f ${TESTDIR}/random1 $container random1
	storage set-container-data -f ${TESTDIR}/random2 $container random2

	# Get information about the container, and make sure the ID, name, and data names were preserved.
	run storage container $container
	echo "$output"
	[ "$status" -eq 0 ]
	[[ "$output" =~ "ID: $container" ]]
	[[ "$output" =~ "Name: $name" ]]
	[[ "$output" =~ "Data: random1" ]]
	[[ "$output" =~ "Data: random2" ]]
}