Skip to content

Commit

Permalink
Remove gomega in LoadBMCConfig()
Browse files Browse the repository at this point in the history
  • Loading branch information
mquhuy committed Jul 4, 2024
1 parent 7c30db5 commit 79f06df
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
13 changes: 8 additions & 5 deletions test/e2e/bmc.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package e2e
import (
"os"

. "github.com/onsi/gomega"
"gopkg.in/yaml.v2"
)

Expand All @@ -28,10 +27,14 @@ type BMC struct {
SSHPort string `yaml:"sshPort,omitempty"`
}

func LoadBMCConfig(configPath string) *[]BMC {
func LoadBMCConfig(configPath string) (*[]BMC, error) {
configData, err := os.ReadFile(configPath) //#nosec
Expect(err).ToNot(HaveOccurred(), "Failed to read the bmcs config file")
var bmcs []BMC
Expect(yaml.Unmarshal(configData, &bmcs)).To(Succeed())
return &bmcs
if err != nil {
return nil, err
}
if err := yaml.Unmarshal(configData, &bmcs); err != nil {
return nil, err
}
return &bmcs, nil
}
3 changes: 2 additions & 1 deletion test/e2e/e2e_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,8 @@ var _ = SynchronizedBeforeSuite(func() []byte {
err := metal3api.AddToScheme(scheme)
Expect(err).NotTo(HaveOccurred())
e2eConfig = LoadE2EConfig(configPath)
bmcs = LoadBMCConfig(bmcConfigPath)
bmcs, err := LoadBMCConfig(bmcConfigPath)
Expect(err).ToNot(HaveOccurred(), "Failed to read the bmcs config file")
bmc = (*bmcs)[GinkgoParallelProcess()-1]
clusterProxy = framework.NewClusterProxy("bmo-e2e", kubeconfigPath, scheme)
})
Expand Down

0 comments on commit 79f06df

Please sign in to comment.