test: Always create test config for package testing (#12390)

This commit is contained in:
Joshua Powers 2022-12-15 07:43:40 -07:00 committed by GitHub
parent 9f55bc605e
commit 0fadaec30c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 19 additions and 22 deletions

View File

@ -95,9 +95,7 @@ func (c *Container) Install(packageName ...string) error {
} }
func (c *Container) CheckStatus(serviceName string) error { func (c *Container) CheckStatus(serviceName string) error {
// the RPM does not start automatically service on install // push a valid config first, then start the service
// write valid, but simple config file and start
if c.packageManager != "apt" {
err := c.client.Exec( err := c.client.Exec(
c.Name, c.Name,
"bash", "bash",
@ -116,9 +114,8 @@ func (c *Container) CheckStatus(serviceName string) error {
_ = c.client.Exec(c.Name, "journalctl", "--no-pager", "--unit", serviceName) _ = c.client.Exec(c.Name, "journalctl", "--no-pager", "--unit", serviceName)
return err return err
} }
}
err := c.client.Exec(c.Name, "systemctl", "status", serviceName) err = c.client.Exec(c.Name, "systemctl", "status", serviceName)
if err != nil { if err != nil {
_ = c.client.Exec(c.Name, "journalctl", "--no-pager", "--unit", serviceName) _ = c.client.Exec(c.Name, "journalctl", "--no-pager", "--unit", serviceName)
return err return err