|
180 | 180 | run_podman 125 quadlet install $multi_quadlet_file |
181 | 181 | assert "$output" =~ "missing required.*FileName" "error should mention missing FileName" |
182 | 182 | } |
| 183 | + |
| 184 | +@test "quadlet verb - multi-quadlet file creates application" { |
| 185 | + # Test that quadlets from a .quadlets file are treated as part of the same application |
| 186 | + local install_dir=$(get_quadlet_install_dir) |
| 187 | + local multi_quadlet_file=$PODMAN_TMPDIR/myapp.quadlets |
| 188 | + |
| 189 | + cat > $multi_quadlet_file <<EOF |
| 190 | +# FileName=webapp |
| 191 | +[Container] |
| 192 | +Image=$IMAGE |
| 193 | +ContainerName=webapp |
| 194 | +PublishPort=8080:80 |
| 195 | +
|
| 196 | +--- |
| 197 | +
|
| 198 | +# FileName=webdb |
| 199 | +[Volume] |
| 200 | +Label=app=myapp |
| 201 | +EOF |
| 202 | + |
| 203 | + # Install the multi-quadlet file |
| 204 | + run_podman quadlet install $multi_quadlet_file |
| 205 | + |
| 206 | + # Verify both quadlets were installed |
| 207 | + assert "$output" =~ "webapp.container" "install output should contain webapp.container" |
| 208 | + assert "$output" =~ "webdb.volume" "install output should contain webdb.volume" |
| 209 | + |
| 210 | + # Check that the .app file was created (not individual .asset files) |
| 211 | + [[ -f "$install_dir/.myapp.app" ]] || die ".myapp.app file should exist" |
| 212 | + [[ ! -f "$install_dir/.webapp.container.asset" ]] || die "individual .asset files should not exist" |
| 213 | + [[ ! -f "$install_dir/.webdb.volume.asset" ]] || die "individual .asset files should not exist" |
| 214 | + |
| 215 | + # Verify the .app file contains both quadlet names |
| 216 | + run cat "$install_dir/.myapp.app" |
| 217 | + assert "$output" =~ "webapp.container" ".app file should contain webapp.container" |
| 218 | + assert "$output" =~ "webdb.volume" ".app file should contain webdb.volume" |
| 219 | + |
| 220 | + # Test quadlet list to verify both quadlets show the same app name |
| 221 | + run_podman quadlet list |
| 222 | + local webapp_line=$(echo "$output" | grep "webapp.container") |
| 223 | + local webdb_line=$(echo "$output" | grep "webdb.volume") |
| 224 | + |
| 225 | + # Both lines should contain the same app name (.myapp.app) |
| 226 | + assert "$webapp_line" =~ "\\.myapp\\.app" "webapp should show .myapp.app as app" |
| 227 | + assert "$webdb_line" =~ "\\.myapp\\.app" "webdb should show .myapp.app as app" |
| 228 | + |
| 229 | + # Test removing the application by removing one quadlet should remove both |
| 230 | + run_podman quadlet rm webapp.container |
| 231 | + |
| 232 | + # Both quadlets should be removed since they're part of the same app |
| 233 | + run_podman quadlet list |
| 234 | + assert "$output" !~ "webapp.container" "webapp.container should be removed" |
| 235 | + assert "$output" !~ "webdb.volume" "webdb.volume should also be removed as part of same app" |
| 236 | + |
| 237 | + # The .app file should also be removed |
| 238 | + [[ ! -f "$install_dir/.myapp.app" ]] || die ".myapp.app file should be removed" |
| 239 | +} |
0 commit comments