diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2021-02-22 13:44:43 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-02-22 13:44:43 -0500 |
commit | a6e7d19c463a55a7d3bf6e47faec1906f3f32380 (patch) | |
tree | 3d3ef05a6bd448177c737cf0d6ba92ededd84934 /pkg/systemd/generate/pods_test.go | |
parent | f8ff1727eca1ca726f00f5509fae5d9ca024f516 (diff) | |
parent | d2f3098c6f9068edfe4012387cef2e6d140ef20a (diff) | |
download | podman-a6e7d19c463a55a7d3bf6e47faec1906f3f32380.tar.gz podman-a6e7d19c463a55a7d3bf6e47faec1906f3f32380.tar.bz2 podman-a6e7d19c463a55a7d3bf6e47faec1906f3f32380.zip |
Merge pull request #9445 from jmguzik/no-header-info-for-systemd-generation
No header info for systemd generation
Diffstat (limited to 'pkg/systemd/generate/pods_test.go')
-rw-r--r-- | pkg/systemd/generate/pods_test.go | 47 |
1 files changed, 38 insertions, 9 deletions
diff --git a/pkg/systemd/generate/pods_test.go b/pkg/systemd/generate/pods_test.go index 068df38d9..50c8d4556 100644 --- a/pkg/systemd/generate/pods_test.go +++ b/pkg/systemd/generate/pods_test.go @@ -37,9 +37,11 @@ func TestValidateRestartPolicyPod(t *testing.T) { } func TestCreatePodSystemdUnit(t *testing.T) { - podGood := `# pod-123abc.service -# autogenerated by Podman CI - + serviceInfo := `# pod-123abc.service +` + headerInfo := `# autogenerated by Podman CI +` + podContent := ` [Unit] Description=Podman pod-123abc.service Documentation=man:podman-generate-systemd(1) @@ -61,6 +63,8 @@ Type=forking [Install] WantedBy=multi-user.target default.target ` + podGood := serviceInfo + headerInfo + podContent + podGoodNoHeaderInfo := serviceInfo + podContent podGoodNamedNew := `# pod-123abc.service # autogenerated by Podman CI @@ -171,11 +175,12 @@ WantedBy=multi-user.target default.target ` tests := []struct { - name string - info podInfo - want string - new bool - wantErr bool + name string + info podInfo + want string + new bool + noHeader bool + wantErr bool }{ {"pod", podInfo{ @@ -192,6 +197,24 @@ WantedBy=multi-user.target default.target podGood, false, false, + false, + }, + {"pod noHeader", + podInfo{ + Executable: "/usr/bin/podman", + ServiceName: "pod-123abc", + InfraNameOrID: "jadda-jadda-infra", + RestartPolicy: "always", + PIDFile: "/run/containers/storage/overlay-containers/639c53578af4d84b8800b4635fa4e680ee80fd67e0e6a2d4eea48d1e3230f401/userdata/conmon.pid", + StopTimeout: 42, + PodmanVersion: "CI", + RequiredServices: []string{"container-1", "container-2"}, + CreateCommand: []string{"podman", "pod", "create", "--name", "foo", "bar=arg with space"}, + }, + podGoodNoHeaderInfo, + false, + true, + false, }, {"pod with root args", podInfo{ @@ -208,6 +231,7 @@ WantedBy=multi-user.target default.target podGood, false, false, + false, }, {"pod --new", podInfo{ @@ -224,6 +248,7 @@ WantedBy=multi-user.target default.target podGoodNamedNew, true, false, + false, }, {"pod --new with root args", podInfo{ @@ -240,6 +265,7 @@ WantedBy=multi-user.target default.target podGoodNamedNewWithRootArgs, true, false, + false, }, {"pod --new with --replace=false", podInfo{ @@ -256,6 +282,7 @@ WantedBy=multi-user.target default.target podGoodNamedNewWithReplaceFalse, true, false, + false, }, {"pod --new with double curly braces", podInfo{ @@ -272,6 +299,7 @@ WantedBy=multi-user.target default.target podNewLabelWithCurlyBraces, true, false, + false, }, } @@ -279,7 +307,8 @@ WantedBy=multi-user.target default.target test := tt t.Run(tt.name, func(t *testing.T) { opts := entities.GenerateSystemdOptions{ - New: test.new, + New: test.new, + NoHeader: test.noHeader, } got, err := executePodTemplate(&test.info, opts) if (err != nil) != test.wantErr { |