Skip to content

Commit

Permalink
updating go.mod to 1.21, fixing config test
Browse files Browse the repository at this point in the history
  • Loading branch information
parMaster committed Sep 8, 2023
1 parent 4de0912 commit 1df2024
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 41 deletions.
43 changes: 3 additions & 40 deletions config/config_test.go
Original file line number Diff line number Diff line change
@@ -1,51 +1,14 @@
package config

import (
"log"
"testing"

"github.com/stretchr/testify/assert"
)

func Test_LoadConfig(t *testing.T) {

// Expected default config:
expected := Parameters{
Server: Server{
Listen: ":8095",
Dbg: false,
},
Fan: Fan{
TachPin: "GPIO15",
ControlPin: "GPIO18",
High: 48,
Low: 40,
},
Storage: Storage{
Type: "sqlite",
Path: "file:/etc/rpid/data.db?mode=rwc&_journal_mode=WAL",
},
Modules: Modules{
BMP280: BMP280{
Enabled: true,
Bmp280Addr: 118,
},
HTU21: HTU21{
Enabled: true,
Htu21Addr: 64,
},
System: System{
Enabled: true,
},
I2C: "4",
},
}

var conf *Parameters
var err error
conf, err = NewConfig("config.yml")
if err != nil {
log.Fatalf("[ERROR] can't load config, %s", err)
}
assert.Equal(t, expected, *conf)
conf, err := NewConfig("config.yml")
assert.NoError(t, err)
assert.NotNil(t, conf)
}
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/parMaster/rpid

go 1.20
go 1.21

require (
github.com/go-chi/chi/v5 v5.0.8
Expand Down
1 change: 1 addition & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ github.com/go-pkgz/lgr v0.10.4/go.mod h1:CD0s1z6EFpIUplV067gitF77tn25JItzwHNKAPq
github.com/go-pkgz/rest v1.17.0 h1:LoBI/lDBMuqwWhOOkc6thM9NnwJO+K9nWvCOjZ7BAgE=
github.com/go-pkgz/rest v1.17.0/go.mod h1:HHlLOt02NJc2sgffXBF6hYVMcRo4Gz3vjg43zTzN7VM=
github.com/jonboulle/clockwork v0.3.0 h1:9BSCMi8C+0qdApAp4auwX0RkLGUjs956h0EkuQymUhg=
github.com/jonboulle/clockwork v0.3.0/go.mod h1:Pkfl5aHPm1nk2H9h0bjmnJD/BcgbGXUBGnn1kMkgxc8=
github.com/mattn/go-sqlite3 v1.14.16 h1:yOQRA0RpS5PFz/oikGwBEqvAWhWg5ufRz4ETLjwpU1Y=
github.com/mattn/go-sqlite3 v1.14.16/go.mod h1:2eHXhiwb8IkHr+BDWZGa96P6+rkvnG63S2DGjv9HUNg=
github.com/parMaster/htu21 v0.0.0-20230220190438-31e4538dc67a h1:TOAqYxV6fBjuppOP/YNZsit/PkBXvK26EsnHWYKeTCA=
Expand Down

0 comments on commit 1df2024

Please sign in to comment.