mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-04-14 06:17:42 +00:00
tfk8s: add passthru.tests.sample1
This commit is contained in:
parent
0bac0bfd72
commit
909c6f0394
@ -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;
|
||||
|
11
pkgs/tools/misc/tfk8s/tests/sample1/default.nix
Normal file
11
pkgs/tools/misc/tfk8s/tests/sample1/default.nix
Normal file
@ -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
|
||||
''
|
7
pkgs/tools/misc/tfk8s/tests/sample1/input.yaml
Normal file
7
pkgs/tools/misc/tfk8s/tests/sample1/input.yaml
Normal file
@ -0,0 +1,7 @@
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: test
|
||||
data:
|
||||
TEST: test
|
12
pkgs/tools/misc/tfk8s/tests/sample1/output.tf
Normal file
12
pkgs/tools/misc/tfk8s/tests/sample1/output.tf
Normal file
@ -0,0 +1,12 @@
|
||||
resource "kubernetes_manifest" "configmap_test" {
|
||||
manifest = {
|
||||
"apiVersion" = "v1"
|
||||
"data" = {
|
||||
"TEST" = "test"
|
||||
}
|
||||
"kind" = "ConfigMap"
|
||||
"metadata" = {
|
||||
"name" = "test"
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user