Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix check for systemd-timesyncd.service #512

Merged
merged 3 commits into from
Mar 26, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions kola/tests/bpf/local-gadget.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ func localGadgetTest(c cluster.TestCluster) {

tmpl, err := template.New("user-data").Parse(config)
if err != nil {
c.Fatalf("parsing user-data: %w", err)
c.Fatalf("parsing user-data: %v", err)
}

c.Run("dns gadget", func(c cluster.TestCluster) {
Expand All @@ -133,7 +133,7 @@ func localGadgetTest(c cluster.TestCluster) {

var buf bytes.Buffer
if err := tmpl.Execute(&buf, gadget); err != nil {
c.Fatalf("rendering user-data: %w", err)
c.Fatalf("rendering user-data: %v", err)
}

node, err := c.NewMachine(conf.ContainerLinuxConfig(buf.String()))
Expand Down
23 changes: 17 additions & 6 deletions kola/tests/coretest/core.go
Original file line number Diff line number Diff line change
Expand Up @@ -322,27 +322,38 @@ func TestServicesActive() error {
return servicesActive([]string{
"multi-user.target",
"docker.socket",
"systemd-timesyncd.service",
"update-engine.service",
}, []string{
"systemd-timesyncd.service",
"chronyd.service",
"ntpd.service",
})
}

func TestServicesActiveCoreOS() error {
return servicesActive([]string{
"multi-user.target",
})
}, []string{})
}

func servicesActive(units []string) error {
func servicesActive(allOf []string, anyOf []string) error {
//t.Parallel()
for _, unit := range units {
for _, unit := range allOf {
c := exec.Command("systemctl", "is-active", unit)
err := c.Run()
if err != nil {
return fmt.Errorf("Services Active: %v", err)
return fmt.Errorf("services Active: %s: %v", unit, err)
}
}
return nil
var err error
for _, unit := range anyOf {
c := exec.Command("systemctl", "is-active", unit)
err = c.Run()
if err == nil {
return nil
}
}
return fmt.Errorf("no NTP service active: %v", err)
}

func TestServicesDisabledRHCOS() error {
Expand Down
2 changes: 1 addition & 1 deletion kola/tests/ostree/basic.go
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ func ostreeRemoteTest(c cluster.TestCluster) {
osRemoteListSplit := strings.Split(string(osRemoteListOut), "\n")
// should have original remote + newly added remote
if len(osRemoteListSplit) != initialRemotesNum+1 {
c.Fatalf(`Did not find expected amount of ostree remotes: %q. Expected %d`, string(osRemoteListOut), osRemoteListSplit)
c.Fatalf(`Did not find expected amount of ostree remotes: %q. Expected %d`, string(osRemoteListOut), len(osRemoteListSplit))
}

var remoteFound bool = false
Expand Down
2 changes: 1 addition & 1 deletion kola/tests/ostree/unlock.go
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ func ostreeHotfixTest(c cluster.TestCluster) {
}

if rollbackStatus.Deployments[0].Unlocked != "none" {
c.Fatalf(`Rollback did not remove hotfix mode; got: $q`, rollbackStatus.Deployments[0].Unlocked)
c.Fatalf(`Rollback did not remove hotfix mode; got: %q`, rollbackStatus.Deployments[0].Unlocked)
}

_, secCmdErr := c.SSH(m, ("command -v " + rpmName))
Expand Down
2 changes: 1 addition & 1 deletion kola/tests/rpmostree/deployments.go
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ func rpmOstreeInstallUninstall(c cluster.TestCluster) {

// check the metadata to make sure everything went well
if len(postUninstallStatus.Deployments) != 2 {
c.Fatal("Expected %d deployments, got %d", 2, len(postUninstallStatus.Deployments))
c.Fatalf("Expected %d deployments, got %d", 2, len(postUninstallStatus.Deployments))
}

if postUninstallStatus.Deployments[0].Checksum != originalCsum {
Expand Down