gotest/

directory
v1.16.0 Latest Latest
Warning

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

Go to latest
Published: Jun 18, 2024 License: MIT, Apache-2.0

README ยถ

GoTest Module for Dagger

Dagger Version

A simple Dagger module that wraps Go testing functionality to run Go tests within a containerized environment.

Configuration ๐Ÿ› ๏ธ

Through the Dagger CLI, or by using it directly within your module, you can configure the following options:

  • โš™๏ธ ctr: The container to use as a base container. If not specified, a new container is created.
  • โš™๏ธ version: The version of the Go image to use. Defaults to latest.
  • โš™๏ธ image: The Go image to use. Defaults to golang:alpine.
  • โš™๏ธ envVarsFromHost: Environment variables to pass from the host to the container.

Features ๐ŸŽจ

Command or functionality Command Example Status
Run Go Tests run dagger call run-go-test --packages="./..." --enableVerbose=true --race=true --src="my-code/src" โœ…
Run GoTestSum gotestsum dagger call run-go-test-sum --src="mydir/src" --race=true --testFlags="-json" --goTestSumFlags="--format=short-verbose" --format="short" --enablePretty=true โœ…

Using the GoTest Module

This module allows you to integrate Go testing into your Dagger pipelines easily. To use it, simply specify the source directory and the desired command. The module can execute various Go testing functions, including running tests and using gotestsum for advanced test result formatting.

Additional Information
  • GoTestSum: GoTestSum is a tool for running and summarizing Go tests. More details can be found in the GoTestSum Documentation.
  • Dagger: Dagger is a portable devkit for CI/CD pipelines, allowing you to define your pipeline as code and execute it anywhere. For more on Dagger, visit Dagger.io.

Usage ๐Ÿš€

dagger call run-go-test --src="../../test/testdata/gotest" \
--test-flags="--json" --enable-cache;

dagger call --verbose run-go-test-sum --src="../../test/testdata/gotest" \
--enable-pretty --enable-cache;

Testing ๐Ÿงช

This module includes a testing module that aims to test the functionality of the GoTest module. The tests are written in Go and can be run using the following command:

## Run the tests using the just command
just test gotest

NOTE: The just command entails the use of the Justfile for task automation.

Directories ยถ

Path Synopsis
tests
dagger command
A generated module for Tests functions
A generated module for Tests functions

Jump to

Keyboard shortcuts

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