mirror of
https://github.com/kubernetes-sigs/kustomize.git
synced 2026-06-10 08:20:59 +00:00
Gave up to install docker in pod. Just skipping tests that require docker if there is no binary
This commit is contained in:
17
Makefile
17
Makefile
@@ -4,9 +4,8 @@
|
||||
# Makefile for kustomize CLI and API.
|
||||
|
||||
MYGOBIN := $(shell go env GOPATH)/bin
|
||||
MYDOCKERBIN := $(HOME)/bin
|
||||
SHELL := /bin/bash
|
||||
export PATH := $(MYGOBIN):$(MYDOCKERBIN):$(PATH)
|
||||
export PATH := $(MYGOBIN):$(PATH)
|
||||
|
||||
.PHONY: all
|
||||
all: verify-kustomize
|
||||
@@ -195,19 +194,9 @@ lint-kustomize: install-tools $(builtinplugins)
|
||||
build-kustomize-api: $(builtinplugins)
|
||||
cd api; go build ./...
|
||||
|
||||
# Using the approach from https://docs.docker.com/engine/security/rootless/#install
|
||||
# pinning docker 19.03.11
|
||||
$(MYDOCKERBIN)/docker:
|
||||
cat /etc/os-release
|
||||
apt -y update && apt -y upgrade
|
||||
apt-get install -y uidmap
|
||||
echo "root:100000:65536" >> /etc/subuid
|
||||
echo "root:100000:65536" >> /etc/subgid
|
||||
curl -fsSL https://raw.githubusercontent.com/docker/docker-install/3d1b8a8/rootless-install.sh | SKIP_IPTABLES=1 FORCE_ROOTLESS_INSTALL=1 sh
|
||||
|
||||
.PHONY: test-unit-kustomize-api
|
||||
test-unit-kustomize-api: build-kustomize-api $(MYDOCKERBIN)/docker
|
||||
export XDG_RUNTIME_DIR=/tmp/docker-0; export DOCKER_HOST=unix:///tmp/docker-0/docker.sock; /root/bin/dockerd-rootless.sh --experimental --iptables=false --storage-driver vfs & cd api; go test ./... -ldflags "-X sigs.k8s.io/kustomize/api/provenance.version=v444.333.222"
|
||||
test-unit-kustomize-api: build-kustomize-api
|
||||
cd api; go test ./... -ldflags "-X sigs.k8s.io/kustomize/api/provenance.version=v444.333.222"
|
||||
|
||||
.PHONY: test-unit-kustomize-plugins
|
||||
test-unit-kustomize-plugins:
|
||||
|
||||
@@ -1,12 +1,21 @@
|
||||
package krusty_test
|
||||
|
||||
import (
|
||||
"os/exec"
|
||||
"testing"
|
||||
|
||||
kusttest_test "sigs.k8s.io/kustomize/api/testutils/kusttest"
|
||||
)
|
||||
|
||||
func skipIfNoDocker(t *testing.T) {
|
||||
if _, err := exec.LookPath("docker"); err != nil {
|
||||
t.Skip("skipping because docker binary wasn't found in PATH")
|
||||
}
|
||||
}
|
||||
|
||||
func TestFnGenerator(t *testing.T) {
|
||||
skipIfNoDocker(t)
|
||||
|
||||
th := kusttest_test.MakeEnhancedHarness(t)
|
||||
defer th.Reset()
|
||||
|
||||
@@ -221,6 +230,8 @@ spec:
|
||||
}
|
||||
|
||||
func TestFnTransformer(t *testing.T) {
|
||||
skipIfNoDocker(t)
|
||||
|
||||
th := kusttest_test.MakeEnhancedHarness(t)
|
||||
defer th.Reset()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user