Skip to content

Commit

Permalink
fix(rpm): Resolve nightly rpm tests (#13884)
Browse files Browse the repository at this point in the history
  • Loading branch information
powersj authored Sep 7, 2023
1 parent ce6e4b4 commit 3607519
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 2 deletions.
3 changes: 2 additions & 1 deletion scripts/rpm/post-install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ if [[ ! -d /etc/telegraf/telegraf.d ]]; then
fi

# If 'telegraf.conf' is not present use package's sample (fresh install)
if [[ ! -f /etc/telegraf/telegraf.conf ]] && [[ -f /etc/telegraf/telegraf.conf.sample ]]; then
if [[ ! -f /etc/telegraf/telegraf.conf ]] && [[ ! -f /etc/telegraf/telegraf.conf.rpmnew ]] &&
[[ ! -f /etc/telegraf/telegraf.conf.rpmsave ]] && [[ -f /etc/telegraf/telegraf.conf.sample ]]; then
cp /etc/telegraf/telegraf.conf.sample /etc/telegraf/telegraf.conf
chmod 640 /etc/telegraf/telegraf.conf
chmod 750 /etc/telegraf/telegraf.d
Expand Down
11 changes: 11 additions & 0 deletions tools/package_lxd_test/container.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,17 @@ func (c *Container) CheckStatus(serviceName string) error {
return err
}

err = c.client.Exec(
c.Name,
"bash",
"-c",
"--",
"ls -la /etc/telegraf/",
)
if err != nil {
return err
}

err = c.client.Exec(c.Name, "systemctl", "start", serviceName)
if err != nil {
_ = c.client.Exec(c.Name, "systemctl", "status", serviceName)
Expand Down
7 changes: 6 additions & 1 deletion tools/package_lxd_test/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ func main() {
Name: "package",
Usage: ".deb or .rpm file for upgrade testing",
Destination: &packageFile,
Required: true,
},
&cli.StringFlag{
Name: "image",
Expand All @@ -44,6 +45,10 @@ func main() {
},
},
Action: func(c *cli.Context) error {
if _, err := os.Stat(packageFile); err != nil {
return fmt.Errorf("unknown package file: %w", err)
}

if image != "" && packageFile != "" {
fmt.Printf("test package %q on image %q\n", packageFile, image)
return launchTests(packageFile, []string{image})
Expand All @@ -61,7 +66,7 @@ func main() {
}
}

return fmt.Errorf("please provide at least a package to test")
return nil
},
}

Expand Down

0 comments on commit 3607519

Please sign in to comment.