Integration Testing: improve code to allow additional error codes in execute
- Old behavior was to allow execute to ignore any return code from an
in-target command with ignore_errors
- Replace this with a list of acceptable return codes similar to util.subp
which allows better control over command execution
- pylxd 2.1.3 does not allow error checking during setup as it does nto return
command exit code
- remove the tox env for running integration tests using pylxd 2.1.3 and keep
default environment using 2.2.3
Integration Testing: Cache lxd base images for cloud_tests
- Cache lxd images cloud-test runs to avoid downloading images multiple times
- Modified versions of images will still be removed, only base image kept
- Image config option 'cache_base_image' controls this behavior
- Enabled by default for all releases on lxd
- Allow using pylxd 2.2.x or pylxd 2.1.x in LXDInstance
- handle .execute() return for either version
- assume exit_code of 0 if pylxd 2.1.x as exit code is not returned
- Switched citest tox env to pylxd 2.2.3
- citest env using pylxd 2.1.3 still available as citest_old_pylxd
- using pylxd 2.2.x enables detecting if setup commands failed and
additional error handling
- pylxd 2.2.3 includes fix for https://github.com/lxc/pylxd/issues/209
which had prevented using pylxd 2.2.x previously
Integration Testing: Allow image config to override setup_image options
- Add setup_overrides to config to allow args to be overridden during image
setup and add upgrade: true by default for lxd images
- Add setup_overrides property to images
- Add util.update_args() to apply overrides to args
- Use a copy of args during setup_image and update copy with overrides
Integration Testing: Update lxd image templates if necessary
- some images come with lxd image metadata that does not provide nocloud seed
- add image export and import functionality to LXDImage
- fix this by exporting image, extracting metadata, adding new template
scripts, then importing as new image
- allows use of linuxcontainers.org images, which are available for distros
other than ubuntu
Integration Testing: Clean up and improve instance boot and execute
- Improve instance.run_script():
- return full (out, err, exit) tuple instead of just the stdout,
allowing additional error checking
- clean up tempfile after script has been run
- generate tempfile names using 'mktemp' to avoid possible name conflicts
- Refactor code to wait for the system to boot
- use 'system_ready_script' from image config rather than hardcoded script
- poll for in the instance rather than on the host to avoid excessive calls
to execute()
- check for the system to boot and cloud-init to complete separately,
allowing images with cloud-init not installed to be booted by setup_image
- execute ready script commands directly in loop, instead of writing tempfile
- use .execute() instead of .run_script() to avoid file writes
- Switched to new image config format to allow more image control options:
- new image config format allows all options in image config to be
overridden on a per platform and per image basis
- default image config defined on a per platform basis with global default
- releases have a default config and per platform overrides
- override priority order (highest to lowest):
- release's config per platform
- release's default config
- default config per platform
- default config
- Updated image config handling in config:
- handle overrides for new image config format
- clean up utility code for parsing release config
- use cached config.ENABLED_DISTROS and config.ENABLED_PLATFORMS rather than
scanning for enabled releases and platforms multiple times
- check that requested config is enabled in cloud_tests.config by default
- Update platforms to handle new image config
- Pass image config and properties through all platform objects