Skip to content

Commit

Permalink
fix: the tests checks if they can set the environment variables
Browse files Browse the repository at this point in the history
  • Loading branch information
adjivas committed Feb 28, 2025
1 parent 738b5fe commit 7622c81
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
8 changes: 6 additions & 2 deletions internal/context/context_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -253,8 +253,12 @@ func TestInitUdmContextWithConfigIPv6FromEnv(t *testing.T) {

configFile := createConfigFile(t, postContent)

os.Setenv("MY_REGISTER_IP", "2001:db8::1:0:0:130")
os.Setenv("MY_BINDING_IP", "2001:db8::1:0:0:130")
if err := os.Setenv("MY_REGISTER_IP", "2001:db8::1:0:0:130"); err != nil {
t.Errorf("Can't set MY_BINDING_IP variable environnement: %+v", err)
}
if err := os.Setenv("MY_BINDING_IP", "2001:db8::1:0:0:130"); err != nil {
t.Errorf("Can't set MY_BINDING_IP variable environnement: %+v", err)
}

// Test the initialization with the config file
cfg, err := factory.ReadConfig(configFile.Name())
Expand Down
4 changes: 1 addition & 3 deletions pkg/factory/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,7 @@ type Logger struct {

func (c *Configuration) validate() (bool, error) {
if sbi := c.Sbi; sbi != nil {
if result, err := sbi.validate(); err != nil {
return result, err
}
sbi.validate()

Check failure on line 80 in pkg/factory/config.go

View workflow job for this annotation

GitHub Actions / lint (1.21)

Error return value of `sbi.validate` is not checked (errcheck)
} else {
sbi := Sbi{}
result, err := sbi.validate()
Expand Down

0 comments on commit 7622c81

Please sign in to comment.