Skip to content

Commit

Permalink
Merge pull request #1806 from Nordix/mquhuy/remove-gomega-from-bmc.go
Browse files Browse the repository at this point in the history
🌱 E2E: Remove gomega in LoadBMCConfig()
  • Loading branch information
metal3-io-bot authored Jul 4, 2024
2 parents bcf5305 + 23246c9 commit dc01c5e
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 dc01c5e

Please sign in to comment.