khuedoan-homelab/test/tools_test.go
Khue Doan adbaf32aa5 refactor(tools): switch to Nix
- Nix is more reproducible (pinned to a specific hash)
- Faster rebuild after changing the package list (due to /nix caching in volume)
- Users can still use make tools (wrapped in Docker) without installing Nix
- Using nix-shell will work if you have nix installed.
2022-08-26 19:08:52 +07:00

33 lines
572 B
Go

package test
import (
"fmt"
"path/filepath"
"testing"
"github.com/gruntwork-io/terratest/modules/docker"
)
func TestToolsContainer(t *testing.T) {
image := "nixos/nix"
projectRoot, _ := filepath.Abs("../")
options := &docker.RunOptions{
Remove: true,
Volumes: []string{
fmt.Sprintf("%s:%s", projectRoot, projectRoot),
"homelab-tools-cache:/root/.cache",
"homelab-tools-nix:/nix",
},
OtherOptions: []string{
"--workdir", projectRoot,
},
Command: []string{
"nix-shell",
"--command", "exit",
},
}
docker.Run(t, image, options)
}