ci

package
v1.6.108 Latest Latest
Warning

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

Go to latest
Published: Aug 12, 2023 License: MPL-2.0 Imports: 6 Imported by: 0

README

CI (unit testing)

This README describes how the Core CI Tests Github Actions works, which provides Nomad with continuous integration unit testing.

Steps

  1. When a branch is pushed, GHA triggers .github/workflows/test-core.yaml.

  2. The first job is mods which creates a pre-cache of Go modules.

  • Only useful for the followup jobs on Linux runners
  • Is keyed on hash(go.sum), so a cache is re-used until deps are modified.
  1. The checks, test-api, test-* jobs are started.
  • The checks job runs make check
  • The test job runs groups of tests, see below

3i. The check step also runs make missing

  • Invokes tools/missing to scan ci/test-cores.json && nomad source.
  • Fails the build if any packages in Nomad are not covered.

4a. The test-* jobs are run.

  • Configured as a matrix of "groups"; each group is a set of packages.
  • The GHA invokes test-nomad with $GOTEST_GROUP for each group.
  • The makefile uses tools/missing to translate the group into packages
  • Package groups are configured in ci/test-core.json

4b. The test-api job is run.

  • Because api is a submodule, invokation of test command is special.
  • The GHA invokes test-nomad-module with the name of the submodule.
  1. The compile jobs are run
  • Waits on checks to complete first
  • Runs on each of linux, macos, windows

Documentation

Index

Constants

This section is empty.

Variables

View Source
var PortAllocator = portal.New(
	new(fatalTester),
	portal.WithAddress("127.0.0.1"),
)

PortAllocator is used to acquire unused ports for testing real network listeners.

View Source
var TinyChroot = map[string]string{

	"/usr/bin/sleep": "/bin/sleep",
	"/usr/bin/dash":  "/bin/sh",
	"/usr/bin/bash":  "/bin/bash",
	"/usr/bin/cat":   "/bin/cat",

	"/usr/bin/stty":   "/usr/bin/stty",
	"/usr/bin/head":   "/usr/bin/head",
	"/usr/bin/mktemp": "/usr/bin/mktemp",
	"/usr/bin/echo":   "/usr/bin/echo",
	"/usr/bin/touch":  "/usr/bin/touch",
	"/usr/bin/stat":   "/usr/bin/stat",

	"/etc/ld.so.cache":  "/etc/ld.so.cache",
	"/etc/ld.so.conf":   "/etc/ld.so.conf",
	"/etc/ld.so.conf.d": "/etc/ld.so.conf.d",
	"/etc/passwd":       "/etc/passwd",
	"/etc/resolv.conf":  "/etc/resolv.conf",

	"/lib":                 "/lib",
	"/lib32":               "/lib32",
	"/lib64":               "/lib64",
	"/usr/lib/jvm":         "/usr/lib/jvm",
	"/run/resolvconf":      "/run/resolvconf",
	"/run/systemd/resolve": "/run/systemd/resolve",
}

TinyChroot is useful for testing, where we do not use anything other than trivial /bin commands like sleep and sh. Copying a minimal chroot helps in environments like GHA with very poor [network] disk performance.

Note that you cannot chroot a symlink.

Do not modify this value.

Functions

func Parallel

func Parallel(t *testing.T)

Parallel runs t in parallel, unless CI is set to a true value.

In CI (CircleCI / GitHub Actions) we get better performance by running tests in serial while not restricting GOMAXPROCS.

func SkipSlow

func SkipSlow(t *testing.T, reason string)

SkipSlow skips a slow test unless NOMAD_SLOW_TEST is set to a true value.

func SkipTestWithoutRootAccess

func SkipTestWithoutRootAccess(t *testing.T)

SkipTestWithoutRootAccess will skip test t if it's not running in CI environment and test is not running with Root access.

Types

This section is empty.

Jump to

Keyboard shortcuts

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