testing

package
v0.21.1-pre.20221213 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 13, 2022 License: Apache-2.0 Imports: 8 Imported by: 0

README

Test Docker Image

The Docker image used by the tests is runatlantis/testing-env. It's built by the Dockerfie in this directory.

The image is automatically built by Docker Hub on merges to main.

To update the image, create a pull request that updates the Dockerfile and get it merged to main.

Wait until the build at https://hub.docker.com/repository/docker/runatlantis/testing-env/builds finishes and then scroll to the bottom to find output like:

01216b26cd75183360909a50217a39d55a9265e7: digest: sha256:9c26943a576bf8aaa7a3790f3f8677c68747114e027cfbc361717f49b958e2d1 size: 4741
Build finished

The sha 01216b26cd75183360909a50217a39d55a9265e7 is the tag of the latest image.

In .circleci/config.yml, update the image to reference the new tag:

jobs:
  test:
    docker:
-    - image: runatlantis/testing-env:<old tag>
+    - image: runatlantis/testing-env:<new tag>

And open up a PR.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Assert

func Assert(tb testing.TB, condition bool, msg string, v ...interface{})

Assert fails the test if the condition is false. Taken from https://github.com/benbjohnson/testing.

func Contains

func Contains(tb testing.TB, exp interface{}, slice []string)

Contains fails the test if the slice doesn't contain the expected element

func DirStructure added in v0.4.0

func DirStructure(t *testing.T, structure map[string]interface{}) string

DirStructure creates a directory structure in a temporary directory. structure describes the dir structure. If the value is another map, then the key is the name of a directory. If the value is nil, then the key is the name of a file. If val is a string then key is a file name and val is the file's content. It returns the path to the temp directory containing the defined structure. Example usage:

	versionConfig := `
 terraform {
	  required_version = "= 0.12.8"
 }
 `
	tmpDir := DirStructure(t, map[string]interface{}{
		"pulldir": map[string]interface{}{
			"project1": map[string]interface{}{
				"main.tf": nil,
			},
			"project2": map[string]interface{}{,
				"main.tf": versionConfig,
			},
		},
	})

func Equals

func Equals(tb testing.TB, exp, act interface{})

Equals fails the test if exp is not equal to act. Taken from https://github.com/benbjohnson/testing.

func ErrContains added in v0.4.0

func ErrContains(tb testing.TB, substr string, act error)

ErrContains fails the test if act is nil or act.Error() does not contain substr.

func ErrEquals added in v0.3.2

func ErrEquals(tb testing.TB, exp string, act error)

ErrEquals fails the test if act is nil or act.Error() != exp

func Ok

func Ok(tb testing.TB, err error)

Ok fails the test if an err is not nil. Taken from https://github.com/benbjohnson/testing.

func ResponseContains added in v0.17.1

func ResponseContains(t *testing.T, r *httptest.ResponseRecorder, status int, bodySubstr string)

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL