diff options
author | superherointj <5861043+superherointj@users.noreply.github.com> | 2021-07-14 07:53:00 -0300 |
---|---|---|
committer | superherointj <5861043+superherointj@users.noreply.github.com> | 2021-07-14 09:16:04 -0300 |
commit | 909c6f0394a79b804866437fd898c83fcf8f6cf9 (patch) | |
tree | 8e9232ab1f0327a5b3c7721b5f5865dca7fcda7c /pkgs/tools/misc/tfk8s | |
parent | 0bac0bfd7269cd2390b0cdde1ba264944bab911a (diff) |
tfk8s: add passthru.tests.sample1
Diffstat (limited to 'pkgs/tools/misc/tfk8s')
-rw-r--r-- | pkgs/tools/misc/tfk8s/default.nix | 6 | ||||
-rw-r--r-- | pkgs/tools/misc/tfk8s/tests/sample1/default.nix | 11 | ||||
-rw-r--r-- | pkgs/tools/misc/tfk8s/tests/sample1/input.yaml | 7 | ||||
-rw-r--r-- | pkgs/tools/misc/tfk8s/tests/sample1/output.tf | 12 |
4 files changed, 35 insertions, 1 deletions
diff --git a/pkgs/tools/misc/tfk8s/default.nix b/pkgs/tools/misc/tfk8s/default.nix index 536b8f1386d62..d9c9ad0451bb8 100644 --- a/pkgs/tools/misc/tfk8s/default.nix +++ b/pkgs/tools/misc/tfk8s/default.nix @@ -1,4 +1,4 @@ -{ lib, buildGoModule, fetchFromGitHub }: +{ lib, buildGoModule, fetchFromGitHub, callPackage }: buildGoModule rec { pname = "tfk8s"; @@ -30,6 +30,10 @@ buildGoModule rec { $out/bin/tfk8s --version | grep ${tag} > /dev/null ''; + passthru.tests = { + sample1 = callPackage ./tests/sample1 { }; + }; + meta = with lib; { description = "An utility to convert Kubernetes YAML manifests to Terraform's HCL format"; license = licenses.mit; diff --git a/pkgs/tools/misc/tfk8s/tests/sample1/default.nix b/pkgs/tools/misc/tfk8s/tests/sample1/default.nix new file mode 100644 index 0000000000000..6b06dbf323409 --- /dev/null +++ b/pkgs/tools/misc/tfk8s/tests/sample1/default.nix @@ -0,0 +1,11 @@ +{ runCommandCC, tfk8s }: + +runCommandCC "tfk8s-test-sample1" { + buildInputs = [ + tfk8s + ]; + meta.timeout = 60; + } + '' + cmp <(${tfk8s}/bin/tfk8s -f ${./input.yaml}) ${./output.tf} > $out + '' diff --git a/pkgs/tools/misc/tfk8s/tests/sample1/input.yaml b/pkgs/tools/misc/tfk8s/tests/sample1/input.yaml new file mode 100644 index 0000000000000..58ed0eb11d768 --- /dev/null +++ b/pkgs/tools/misc/tfk8s/tests/sample1/input.yaml @@ -0,0 +1,7 @@ +--- +apiVersion: v1 +kind: ConfigMap +metadata: + name: test +data: + TEST: test diff --git a/pkgs/tools/misc/tfk8s/tests/sample1/output.tf b/pkgs/tools/misc/tfk8s/tests/sample1/output.tf new file mode 100644 index 0000000000000..51d564400b550 --- /dev/null +++ b/pkgs/tools/misc/tfk8s/tests/sample1/output.tf @@ -0,0 +1,12 @@ +resource "kubernetes_manifest" "configmap_test" { + manifest = { + "apiVersion" = "v1" + "data" = { + "TEST" = "test" + } + "kind" = "ConfigMap" + "metadata" = { + "name" = "test" + } + } +} |