Files
Stephen Levine 5ea0f2a214 [teleport-update] Use teleport config package to generate systemd services (#55499)
* Refactor systemd services

* cleanup

* use FIPS in config test

* cleanup

* prevent large package import

* rename testdata file
2025-07-06 00:33:57 +00:00

48 lines
1.4 KiB
Go

/*
* Teleport
* Copyright (C) 2023 Gravitational, Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package systemd
import (
"bytes"
"testing"
"github.com/stretchr/testify/require"
"github.com/gravitational/teleport/lib/utils/testutils/golden"
)
func TestWriteUnitFile(t *testing.T) {
flags := Flags{
EnvironmentFile: "/custom/env/dir/teleport",
PIDFile: "/custom/pid/dir/teleport.pid",
FileDescriptorLimit: 16384,
TeleportInstallationFile: "/custom/install/dir/teleport",
FIPS: true,
}
stdout := new(bytes.Buffer)
err := WriteUnitFile(flags, stdout)
require.NoError(t, err)
data := stdout.Bytes()
if golden.ShouldSet() {
golden.Set(t, data)
}
require.Equal(t, string(golden.Get(t)), stdout.String())
}