Add factory functions for creating sandbox and production instances
Created by: itsjeyd
cf. OC-1554.
Changes
Adds two factory functions for creating instances from the shell:
-
instance_factory
creates instances with settings that are appropriate for sandboxes. -
production_instance_factory
creates instances with settings that are appropriate for production instances.
The only mandatory argument for each function is sub_domain
. Defaults for other fields can be overridden by passing additional keyword arguments to the functions. If necessary it is also possible to modify instances after they have been created by the functions (before starting the provisioning process).
Test instructions
-
Start the shell via
make shell
. -
Import the new functions via:
from instance.factories import instance_factory, production_instance_factory
-
Create a new sandbox instance via:
sandbox = instance_factory(sub_domain="hello.sandbox")
-
Check that
sandbox
has-
use_ephemeral_databases
set toTrue
-
configuration_version
set tomaster
-
openedx_release
set tomaster
-
configuration_extra_settings
set to""
-
-
Create a new production instance via:
production_instance = production_instance_factory(sub_domain="hello.production")
-
Check that
production_instance
has-
use_ephemeral_databases
set toFalse
-
configuration_version
set tonamed-releases/dogwood.rc
-
openedx_release
set tonamed-releases/dogwood.rc
-
configuration_extra_settings
set to the contents of prod-vars.yml
-
-
Create a few more instances, passing in non-default values for some fields. Check that relevant fields are set to correct values on the resulting instances.