Skip to content

Add factory functions for creating sandbox and production instances

Boros Gábor requested to merge production-instance into master

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

  1. Start the shell via make shell.

  2. Import the new functions via:

    from instance.factories import instance_factory, production_instance_factory
  3. Create a new sandbox instance via:

    sandbox = instance_factory(sub_domain="hello.sandbox")
  4. Check that sandbox has

    • use_ephemeral_databases set to True
    • configuration_version set to master
    • openedx_release set to master
    • configuration_extra_settings set to ""
  5. Create a new production instance via:

    production_instance = production_instance_factory(sub_domain="hello.production")
  6. Check that production_instance has

    • use_ephemeral_databases set to False
    • configuration_version set to named-releases/dogwood.rc
    • openedx_release set to named-releases/dogwood.rc
    • configuration_extra_settings set to the contents of prod-vars.yml
  7. 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.

Merge request reports