onecommons / unfurl-gui

vue + apollo + gitlab-ui
Other
5 stars 0 forks source link

Node LTS is recommended

Notes

src/gitlab-oc is a symlink to packages/oc-pages. The oc-pages package is also used in the gitlab-oc repo, so take care when making changes and make sure the code stays portable between gitlab-oc and unfurl-gui. When importing modules from inside oc-pages/ to other locations inside the src/ directory, use the appropriate aliases to prevent resolver errors on gitlab-oc. Check vue.config.js to see what the current aliases resolve to.

See Apollo boilerplate added with vue add apollo... see https://apollo.vuejs.org/

Need to run yarn run apollo:start first to start the apollo graphql server (runs on port 4000).

see https://gitlab-org.gitlab.io/gitlab-ui/ and https://gitlab-org.gitlab.io/gitlab-svgs/

gitlab-ui wraps https://bootstrap-vue.org/ which wraps bootstrap 4

It also depends on https://portal-vue.linusb.org/ which we could use to build a vs-code like minimap of a view using http://asvd.github.io/syncscroll/ or similar.

Fixture/spec generation

Most integration tests hosted in this repository are based off of completed deployments or deployment drafts.

The easiest way to generate fixtures is to fill out a blueprint on unfurl.cloud and export the deployment via Unfurl cli.

  1. Navigate to https://unfurl.cloud/home#clone-instructions or https://unfurl.cloud/<your-username>/dashboard#clone-instructions
  2. Copy and execute the command line snippet for "Clone this Unfurl project if you haven't already"
  3. Run unfurl export --format deployment --file <path-to-unfurl-gui>/cypress/fixtures/generated/deployments/v2/<export-name>.json <path-to-ensemble-yaml>

Jest patch/dryrun test

The test titled ufsv-patch mimics the workflow of a user filling out a deployment blueprint and triggering a dryrun deployment.

Required envvars and params

SPEC_GLOBS: Whitespace separated globs indicating which deployments to be run. Spec are found in cypress/fixtures/generated/deployments/v2 by default, but a different path will be searched depending on TEST_VERSIONS.

GOOGLE_APPLICATION_CREDENTIALS: Even dryrun tests fail when this variable is missing.

--runInBand: For now we do NOT want to try running tests in parallel.

Supported envvars

All Unfurl environment variables pass through to unfurl serve and unfurl deploy.

TEST_VERSIONS: Which version of specs to run (default: v2)

CI: If present, log commands to curl artifacts, write deploy logs to /tmp/${testName}-ufdryrun.log. Outputs will be optimized for this test's companion .gitlab-ci.yml workflow.

PORT: The port to run unfurl serve on (default: 5001)

OC_URL: Base url for jest. Also used for --cloud-server (default https://unfurl.cloud)

OC_NAMESPACE: Namespace to run tests against; in other words - where the blueprints are located. (default: onecommons/blueprints)

SAVE_DRYRUN_LOGS: Write dry run logs to disk.

Example invocation

env TF_PLUGIN_CACHE_DIR=/tmp/plugincache/ TF_DATA_DIR=/tmp/.terraform TF_PLUGIN_CACHE_MAY_BREAK_DEPENDENCY_LOCK_FILE=1 GOOGLE_APPLICATION_CREDENTIALS=/home/onecommons/oc-staging1-6aeb4c6ec6bc.json SPEC_GLOBS='*baserow*' yarn test ufsv-patch -- --runInBand

Default Unfurl envvars

const UNFURL_DEFAULT_ENV = {
  UNFURL_LOGGING: 'trace',
  UNFURL_HOME: '',
  UNFURL_SKIP_SAVE: 'never',
}

Test directory structure and outputs:

Triggering a test pipeline

A test can be triggered via curl | bash as below. The first parameter to the bash script is the test to run (equivalent to the $TEST variable mentioned under Cypress tests).

Example: curl https://raw.githubusercontent.com/onecommons/unfurl-gui/cy-tests/scripts/trigger-pipeline.sh | bash -s baserow will trigger the pipeline with $TEST set to baserow.

If successful the command will output the pipeline URL.

Cypress tests

Cypress tests can be automatically run through gitlab ci by setting the $TEST pipeline variable

Pattern Spec Description
$TEST == "sanity" || $TEST == "visitor" || $TEST == "all" ./cypress/e2e/00_visitor/*.js Sanity checks for signed out users
$TEST == "nestedcloud" || $TEST == "all" ./cypress/e2e/blueprints/*nestedcloud*.js Run nestedcloud tests (must be <namespace>/nestedcloud)
$TEST == "nextcloud" || $TEST == "nextcloud_aws" || $TEST == "all" ./cypress/e2e/blueprints/aws*nextcloud*.js Runs all nextcloud tests on aws
$TEST == "nextcloud" || $TEST == "nextcloud_gcp" || $TEST == "all" ./cypress/e2e/blueprints/gcp*nextcloud*.js Runs all nextcloud tests on gcp
$TEST == "nextcloud" || $TEST == "nextcloud_do" || $TEST == "all" ./cypress/e2e/blueprints/do*nextcloud*.js Runs all nextcloud tests on digital ocean
$TEST =~ /baserow/ || $TEST == "all" ./cypress/e2e/blueprints/*baserow*.js Runs all baserow tests
$TEST =~ /minecraft/ || $TEST == "all" ./cypress/e2e/blueprints/*minecraft*.js Runs all minecraft tests
$TEST == "container_webapp" || $TEST == "all" ./cypress/e2e/blueprints/*container-webapp*.js Runs all container-webapp tests
$TEST == "container_webapp_gcp" ./cypress/e2e/blueprints/gcp__container-webapp*.js Runs container-webapp tests for gcp
$TEST == "container_webapp_aws" ./cypress/e2e/blueprints/aws__container-webapp*.js Runs container-webapp tests for aws
$TEST =~ /ghost/ || $TEST == "all" ./cypress/e2e/blueprints/*ghost*.js Runs all ghost tests
$TEST =~ /mediawiki/ || $TEST == "all" ./cypress/e2e/blueprints/*mediawiki*.js Runs all mediawiki tests
$TEST =~ /wordpress/ || $TEST == "all" ./cypress/e2e/blueprints/*wordpress*.js Runs all wordpress tests
$TEST =~ /k8s/ || ($TEST == "all" && $SKIP !~ /k8s/) ./cypress/e2e/blueprints/k8s__wordpress*.js Runs all kubernetes tests
$TEST =~ /uc_dns/ || $TEST == "all" ./cypress/e2e/blueprints/awsnextcloudonly-mail*.js Runs aws nextcloud with unfurl cloud dns
$TEST == "cloud_redis" cypress/e2e/blueprints/gcpnextcloudmemorystore*.js
cypress/e2e/blueprints/awsnextcloudmemorydb*.js
Runs all cloud redis tests
$TEST == "multiple_workflows" || $TEST == "misc" cypress/e2e/deployments/multiple-workflows*.js Tries to run multiple deployments simultaneously
$TEST == "smorgasbord" cypress/e2e/deployments/smorgasbord*.js Test inputs in smorgasbord blueprint
$TEST == "node_filter" || $TEST == "misc" cypress/e2e/deployments/node-filter*.js Test node filter on baserow
$TEST == "clone_draft" || $TEST == "misc" cypress/e2e/deployments/clone-draft*.js Clone and deploy a draft
$TEST == "drafts" || $TEST == "misc" cypress/e2e/deployments/draft*.js Try to trigger a state desync with drafts
$TEST == "dryrun" cypress/e2e/blueprints/aws*
cypress/e2e/blueprints/az*
DRYRUN aws and azure
$TEST == "dryrun" cypress/e2e/blueprints/gcp*
cypress/e2e/blueprints/do*
DRYRUN aws and azure
$TEST == "shared_volumes" || $TEST == "all" cypress/e2e/deployments/shared-volume*.js Runs all nextcloud shared volume tests
The test does the following:
1. Deploys nextcloud with a volume
2. Shares the volume
3. Tears down the first deployment
4. Creates a new nextcloud deployment with the shared volume
5. Asserts that admin credentials are the same on the new instance
$TEST == "command" N/A evals $CY_COMMAND

Running an arbitrary test examples with $CY_COMMAND