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 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137
|
#!/usr/bin/env bats
load helpers
@test "metadata" {
echo danger > $TESTDIR/danger.txt
# Create a layer.
run storage --debug=false create-layer
[ "$status" -eq 0 ]
[ "$output" != "" ]
layer=$output
# Make sure the layer's there.
storage exists -l $layer
# Create an image using the layer and directly-supplied metadata.
run storage --debug=false create-image -m danger $layer
[ "$status" -eq 0 ]
[ "$output" != "" ]
image=${output%% *}
# Make sure that the image is there.
storage exists -i $image
# Read back the metadata and make sure it's the right value.
run storage --debug=false metadata -q $image
[ "$status" -eq 0 ]
[ "$output" = "danger" ]
# Change the metadata to a directly-supplied value.
run storage set-metadata -m thunder $image
[ "$status" -eq 0 ]
# Read back the metadata and make sure it's the new value.
run storage --debug=false metadata -q $image
[ "$status" -eq 0 ]
[ "$output" = "thunder" ]
# Change the metadata to a value supplied via a file.
storage set-metadata -f $TESTDIR/danger.txt $image
# Read back the metadata and make sure it's the newer value.
run storage --debug=false metadata -q $image
[ "$status" -eq 0 ]
[ "$output" = "danger" ]
# Create an image using the layer and metadata read from a file.
run storage --debug=false create-image -f $TESTDIR/danger.txt $layer
[ "$status" -eq 0 ]
[ "$output" != "" ]
image=${output%% *}
# Make sure that the image is there.
storage exists -i $image
# Read back the metadata and make sure it's the right value.
run storage --debug=false metadata -q $image
[ "$status" -eq 0 ]
[ "$output" = "danger" ]
# Change the metadata to a directly-supplied value.
storage set-metadata -m thunder $image
# Read back the metadata and make sure it's the new value.
run storage --debug=false metadata -q $image
[ "$status" -eq 0 ]
[ "$output" = "thunder" ]
# Change the metadata to a value supplied via a file.
storage set-metadata -f $TESTDIR/danger.txt $image
# Read back the metadata and make sure it's the newer value.
run storage --debug=false metadata -q $image
[ "$status" -eq 0 ]
[ "$output" = "danger" ]
# Create a container based on the image and directly-supplied metadata.
run storage --debug=false create-container -m danger $image
[ "$status" -eq 0 ]
[ "$output" != "" ]
container=${output%% *}
# Make sure the container is there.
storage exists -c $container
# Read the metadata and make sure it's the right value.
run storage --debug=false metadata -q $container
[ "$status" -eq 0 ]
[ "$output" = "danger" ]
# Change the metadata to a new value.
storage set-metadata -m thunder $container
# Read back the new metadata value.
run storage --debug=false metadata -q $container
[ "$status" -eq 0 ]
[ "$output" = "thunder" ]
# Change the metadata to a new value read from a file.
storage set-metadata -f $TESTDIR/danger.txt $container
# Read back the newer metadata value.
run storage --debug=false metadata -q $container
[ "$status" -eq 0 ]
[ "$output" = "danger" ]
# Create a container based on the image and metadata read from a file.
run storage --debug=false create-container -f $TESTDIR/danger.txt $image
[ "$status" -eq 0 ]
[ "$output" != "" ]
container=${output%% *}
# Make sure the container is there.
storage exists -c $container
# Read the metadata and make sure it's the right value.
run storage --debug=false metadata -q $container
[ "$status" -eq 0 ]
[ "$output" = "danger" ]
# Change the metadata to a new value.
storage set-metadata -m thunder $container
# Read back the new metadata value.
run storage --debug=false metadata -q $container
[ "$status" -eq 0 ]
[ "$output" = "thunder" ]
# Change the metadata to a new value read from a file.
storage set-metadata -f $TESTDIR/danger.txt $container
# Read back the newer metadata value.
run storage --debug=false metadata -q $container
[ "$status" -eq 0 ]
[ "$output" = "danger" ]
}
|