Skip to content

Latest commit

 

History

History
122 lines (88 loc) · 3.84 KB

README.md

File metadata and controls

122 lines (88 loc) · 3.84 KB

End to End testing

ToC

How it works

There are 3 main directories:

  • argo-workflows Specification of the end to end testing

  • containers Custom container images needed within the workflows

  • scripts

    • setup-instance Entrypoint and scripts dedicated for environments (locally, AWS dev, AWS gitlab)
    • run-instance Scripts executed in the argo-machine (locally, AWS instance)

setup-instance

run-instance

Command line

AWS development

$ cd ${GOPATH}/src/github.com/DataDog/datadog-agent 
$ aws-vault exec ${DEV} -- inv -e e2e-tests -t dev --agent-image datadog/agent-dev:master --dca-image datadog/cluster-agent-dev:master

Locally (Linux only)

$ inv -e e2e-tests -t local --agent-image datadog/agent-dev:master --dca-image datadog/cluster-agent-dev:master

Argo workflow

The argo documentation is available here, there are a lot of examples here too.

Argo assertion

To assert something in an argo workflow, you need to create a mongodb query:

name: find-kubernetes-state-deployments
activeDeadlineSeconds: 200
script:
  image: mongo:3.6.3
  command: [mongo, "fake-datadog.default.svc.cluster.local/datadog"]
  source: |
    while (1) {
      var nb = db.series.find({
      metric: "kubernetes_state.deployment.replicas_available", 
      tags: {$all: ["namespace:default", "deployment:fake-datadog"] }, 
      "points.0.1": { $eq: 1} });      
      print("find: " + nb)
      if (nb != 0) {
        break;
      }
      prevNb = nb;
      sleep(2000);
    }    

This is an infinite loop with a timeout set by activeDeadlineSeconds: 200. The source is EOF to the command, equivalent to:

mongo "fake-datadog.default.svc.cluster.local/datadog" << EOF
while (1)
[...]
EOF

Try to maximise the usage of MongoDB query system without rewriting too much logic in JavaScript.

See some examples here

To discover more MongoDB capabilities:

Argo container

If you need to add a non existing public container in the workflow, create it in the container directory.

But, keep in mind this become an additional piece of software to maintain.

Upgrade - bump

This section helps you to upgrade any part of the end to end testing.

The current end to end testing pipeline relies on:

Upgrade Argo version by changing version in test/e2e/scripts/run-instance/20-argo-download.sh and setting new checksum value in test/e2e/scripts/run-instance/argo.sha512sum

Upgrade Kind version by changing version in test/e2e/scripts/run-instance/10-setup-kind.sh. By default Kind will use the latest stable Kubernetes known at the time of Kind release.

You don't need to update CoreOS version as the setup script (test/e2e/scripts/setup-instance/00-entrypoint-[dev|gitlab].sh) always uses the latest stable version by default.

If needed, use the ignition-linter to validate any changes.