Skip to content

Commit c0ef7a6

Browse files
committed
Add a unit-test
1 parent b6badd4 commit c0ef7a6

File tree

2 files changed

+34
-2
lines changed

2 files changed

+34
-2
lines changed

.github/workflows/test.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,7 @@ jobs:
1616
run: make docker-build
1717
- name: unit test
1818
run: make test
19+
- name: helm lint
20+
run: make helm-lint
21+
- name: helm template
22+
run: make helm-template

Makefile

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,5 +74,33 @@ run-debug: build
7474
--stderrthreshold=INFO \
7575
--kubeconfig=${KUBECONFIG} \
7676
--linodego-debug
77-
78-
77+
# Set the host's OS. Only linux and darwin supported for now
78+
HOSTOS := $(shell uname -s | tr '[:upper:]' '[:lower:]')
79+
ifeq ($(filter darwin linux,$(HOSTOS)),)
80+
$(error build only supported on linux and darwin host currently)
81+
endif
82+
83+
HELM_VERSION ?= v3.9.1
84+
TOOLS_HOST_DIR ?= .tmp/tools
85+
HELM := $(TOOLS_HOST_DIR)/helm-$(HELM_VERSION)
86+
87+
.PHONY: $(HELM)
88+
$(HELM):
89+
@echo installing helm $(HELM_VERSION)
90+
@mkdir -p $(TOOLS_HOST_DIR)/tmp-helm
91+
@curl -fsSL https://get.helm.sh/helm-$(HELM_VERSION)-$(HOSTOS)-amd64.tar.gz | tar -xz -C $(TOOLS_HOST_DIR)/tmp-helm
92+
@mv $(TOOLS_HOST_DIR)/tmp-helm/$(HOSTOS)-amd64/helm $(HELM)
93+
@rm -fr $(TOOLS_HOST_DIR)/tmp-helm
94+
@echo installing helm $(HELM_VERSION)
95+
96+
.PHONY: helm-lint
97+
helm-lint: $(HELM)
98+
#Verify lint works when region and apiToken are passed, and when it is passed as reference.
99+
@$(HELM) lint deploy/chart --set apiToken="apiToken",region="us-east"
100+
@$(HELM) lint deploy/chart --set secretRef.apiTokenRef="apiToken",secretRef.name="api",secretRef.regionRef="us-east"
101+
102+
.PHONY: helm-template
103+
helm-template: $(HELM)
104+
#Verify template works when region and apiToken are passed, and when it is passed as reference.
105+
@$(HELM) template foo deploy/chart --set apiToken="apiToken",region="us-east" > /dev/null
106+
@$(HELM) template foo deploy/chart --set secretRef.apiTokenRef="apiToken",secretRef.name="api",secretRef.regionRef="us-east" > /dev/null

0 commit comments

Comments
 (0)