e2e

package
v0.24.0 Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2023 License: Apache-2.0 Imports: 10 Imported by: 0

README

Cifuzz E2E tests

Cifuzz supports a growing list of behaviors. Multiplied by the number of supported operating systems, environment setups etc. it's a lot of combinations.

  • Command
  • Arguments and their combinations
  • Operating system
  • Environment and its setup. E.g., CIFUZZ_PRERELEASE=true, tooling flags or config files and their state.
  • Tooling versions. E.g., Gradle versions we rely on. Or Jazzer version.
  • State of SaaS Auth
  • [...]

This end-to-end matrix test is not meant to replace our Integration tests! Our Integration tests cover complex scenarios in detail. The E2E matrix is a way for us to have a high-level, but wide test coverage for the CLI.

Note Tests are currently not blocking PRs or Releases.

They run after every release and on a nightly schedule.

  • Nightly tests are using make install and code that's available in the repository.
  • The release tests are run once, on Release publish, using the latest curl | sh installation method, to simulate the user installing it.

Sample

When I call cifuzz bundle --help Then the exit code is 0 And there is expected help output

func TestHelpArgsWithSubcommands(t *testing.T) {
	e2e.RunTest(t, &e2e.Test{
		Command: "bundle",
		Args:    []string{"--help"},
		Assert: func(t *testing.T, output e2e.CommandOutput) {
			assert.EqualValues(t, 0, output.ExitCode)
			assert.Contains(t, output.Stdout, "This command bundles all runtime artifacts")
		},
	})
}

See tests related to cifuzz help command in the /help folder for more examples.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RunTests added in v0.24.0

func RunTests(t *testing.T, testCases []TestCase)

RunTests Runs all test cases generated from the input combinations

Types

type Assertion

type Assertion func(*testing.T, CommandOutput)

type CommandOutput

type CommandOutput struct {
	ExitCode int
	Stdout   string
	Stderr   string
	Stdall   string // Combined stdout and stderr output for simpler assertions
	Workdir  fs.FS  // Expose files from the test folder
}

type TestCase added in v0.24.0

type TestCase struct {
	Description  string
	Command      string
	Environment  []string
	Args         []string
	SampleFolder []string
	// Os        []OSRuntime // When we will have tests depending on the OS
	// Ciuser    CIUser # TODO: should set a CI token when relevant
	// ToolsRequired []string # TODO: depending on the tools we will want to test
	Assert Assertion
}

Jump to

Keyboard shortcuts

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