gruntwork-io / terratest

Terratest is a Go library that makes it easier to write automated tests for your infrastructure code.
https://terratest.gruntwork.io/
Apache License 2.0
7.46k stars 1.32k forks source link

Is kubectl binary required when testing from Golang container ? #1320

Open Constantin07 opened 1 year ago

Constantin07 commented 1 year ago

This is more an question to understand existing approach(es) as I couldn't find explicit answer documented.

I'm trying to run the tests in Golang container but when executing the KubectlApply it complains about missing kubectl.

Is there a way to deploy test K8s infra without the need of kubectl (using k8s client) ?

I'm not building a dedicated docker image with copied tests inside, just running the Golang container and mounting current folder with test(s).

PS: I would like to avoid creating a custom Golang image with just kubectl inside.

denis256 commented 1 year ago

Hi, kubectl is required to be installed in the environment

References: https://github.com/gruntwork-io/terratest/blob/master/modules/k8s/kubectl.go#L40

Constantin07 commented 1 year ago

Thanks @denis256 for confirmation.