From afc14afe45c10de57fe6ffa26b24285564c17cbe Mon Sep 17 00:00:00 2001 From: Alexey Odinokov Date: Mon, 15 Jun 2020 06:22:22 +0000 Subject: [PATCH] Trying to install rootless docker to run fn tests --- Makefile | 12 +++++++++--- api/krusty/fnplugin_test.go | 5 ++--- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index 69878c008..30a4ec259 100644 --- a/Makefile +++ b/Makefile @@ -4,8 +4,9 @@ # Makefile for kustomize CLI and API. MYGOBIN := $(shell go env GOPATH)/bin +MYDOCKERBIN := $(HOME)/bin SHELL := /bin/bash -export PATH := $(MYGOBIN):$(PATH) +export PATH := $(MYGOBIN):$(MYDOCKERBIN):$(PATH) .PHONY: all all: verify-kustomize @@ -194,9 +195,14 @@ 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: + curl -fsSL https://raw.githubusercontent.com/docker/docker-install/3d1b8a8/rootless-install.sh | sh + .PHONY: test-unit-kustomize-api -test-unit-kustomize-api: build-kustomize-api - cd api; go test ./... -ldflags "-X sigs.k8s.io/kustomize/api/provenance.version=v444.333.222" +test-unit-kustomize-api: build-kustomize-api $(MYDOCKERBIN)/docker + cd api; DOCKER_HOST=unix://$(XDG_RUNTIME_DIR)/docker.sock go test ./... -ldflags "-X sigs.k8s.io/kustomize/api/provenance.version=v444.333.222" .PHONY: test-unit-kustomize-plugins test-unit-kustomize-plugins: diff --git a/api/krusty/fnplugin_test.go b/api/krusty/fnplugin_test.go index 399f0d47f..5a321d52d 100644 --- a/api/krusty/fnplugin_test.go +++ b/api/krusty/fnplugin_test.go @@ -6,8 +6,7 @@ import ( kusttest_test "sigs.k8s.io/kustomize/api/testutils/kusttest" ) -// TODO: enable when get docker installed before these tests start -func disabled_TestFnGenerator(t *testing.T) { +func TestFnGenerator(t *testing.T) { th := kusttest_test.MakeEnhancedHarness(t) defer th.Reset() @@ -221,7 +220,7 @@ spec: `) } -func disabled_TestFnTransformer(t *testing.T) { +func TestFnTransformer(t *testing.T) { th := kusttest_test.MakeEnhancedHarness(t) defer th.Reset()