test(package): fix set up of yum files (#13435)

This commit is contained in:
Joshua Powers 2023-06-14 07:05:21 -06:00 committed by GitHub
parent 866d77192c
commit 3840f6ac1b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 27 additions and 4 deletions

View File

@ -7,10 +7,9 @@ import (
"time"
)
const influxDataRPMRepo = `
[influxdata]
const influxDataRPMRepo = `[influxdata]
name = InfluxData Repository - Stable
baseurl = https://repos.influxdata.com/stable/\$basearch/main
baseurl = https://repos.influxdata.com/stable/x86_64/main
enabled = 1
gpgcheck = 1
gpgkey = https://repos.influxdata.com/influxdata-archive_compat.key
@ -177,6 +176,12 @@ func (c *Container) configureApt() error {
return err
}
_ = c.client.Exec(
c.Name,
"bash", "-c", "--",
"cat /etc/apt/sources.list.d/influxdata.list",
)
err = c.client.Exec(c.Name, "apt-get", "update")
if err != nil {
return err
@ -196,6 +201,12 @@ func (c *Container) configureYum() error {
return err
}
_ = c.client.Exec(
c.Name,
"bash", "-c", "--",
"cat /etc/yum.repos.d/influxdata.repo",
)
// will return a non-zero return code if there are packages to update
return c.client.Exec(c.Name, "bash", "-c", "yum check-update || true")
}
@ -205,12 +216,18 @@ func (c *Container) configureDnf() error {
err := c.client.Exec(
c.Name,
"bash", "-c", "--",
fmt.Sprintf("echo %q > /etc/yum.repos.d/influxdata.repo", influxDataRPMRepo),
fmt.Sprintf("echo -e %q > /etc/yum.repos.d/influxdata.repo", influxDataRPMRepo),
)
if err != nil {
return err
}
_ = c.client.Exec(
c.Name,
"bash", "-c", "--",
"cat /etc/yum.repos.d/influxdata.repo",
)
// will return a non-zero return code if there are packages to update
return c.client.Exec(c.Name, "bash", "-c", "dnf check-update || true")
}
@ -225,6 +242,12 @@ func (c *Container) configureZypper() error {
return err
}
_ = c.client.Exec(
c.Name,
"bash", "-c", "--",
"cat /etc/zypp/repos.d/influxdata.repo",
)
return c.client.Exec(c.Name, "zypper", "refresh")
}