| ... | ... |
@@ -24,6 +24,16 @@ function create_directory_for_kernels {
|
| 24 | 24 |
fi |
| 25 | 25 |
} |
| 26 | 26 |
|
| 27 |
+function create_directory_for_images {
|
|
| 28 |
+ if [ -d "/images" ]; then |
|
| 29 |
+ echo "INFO: /images directory already exists, using that" >&2 |
|
| 30 |
+ else |
|
| 31 |
+ local LOCALPATH="$(get_local_sr_path)/os-images" |
|
| 32 |
+ mkdir -p $LOCALPATH |
|
| 33 |
+ ln -s $LOCALPATH /images |
|
| 34 |
+ fi |
|
| 35 |
+} |
|
| 36 |
+ |
|
| 27 | 37 |
function extract_remote_zipball {
|
| 28 | 38 |
local ZIPBALL_URL=$1 |
| 29 | 39 |
|
| ... | ... |
@@ -138,6 +138,29 @@ function test_create_directory_for_kernels_existing_dir {
|
| 138 | 138 |
EOF |
| 139 | 139 |
} |
| 140 | 140 |
|
| 141 |
+function test_create_directory_for_images {
|
|
| 142 |
+ ( |
|
| 143 |
+ . mocks |
|
| 144 |
+ mock_out get_local_sr uuid1 |
|
| 145 |
+ create_directory_for_images |
|
| 146 |
+ ) |
|
| 147 |
+ |
|
| 148 |
+ assert_directory_exists "/var/run/sr-mount/uuid1/os-images" |
|
| 149 |
+ assert_symlink "/images" "/var/run/sr-mount/uuid1/os-images" |
|
| 150 |
+} |
|
| 151 |
+ |
|
| 152 |
+function test_create_directory_for_images_existing_dir {
|
|
| 153 |
+ ( |
|
| 154 |
+ . mocks |
|
| 155 |
+ given_directory_exists "/images" |
|
| 156 |
+ create_directory_for_images |
|
| 157 |
+ ) |
|
| 158 |
+ |
|
| 159 |
+ diff -u $LIST_OF_ACTIONS - << EOF |
|
| 160 |
+[ -d /images ] |
|
| 161 |
+EOF |
|
| 162 |
+} |
|
| 163 |
+ |
|
| 141 | 164 |
function test_extract_remote_zipball {
|
| 142 | 165 |
local RESULT=$(. mocks && extract_remote_zipball "someurl") |
| 143 | 166 |
|