fix(pkg/logfile): add temperature json testfiles
This commit is contained in:
parent
510819654a
commit
8aa6db6b7d
6
Makefile
6
Makefile
@ -20,6 +20,12 @@ build:
|
|||||||
go build -ldflags "-X main.version=${VERSION}"
|
go build -ldflags "-X main.version=${VERSION}"
|
||||||
chown -R ${UID}:${GID} *
|
chown -R ${UID}:${GID} *
|
||||||
|
|
||||||
|
test: bindata
|
||||||
|
go test -v ./pkg/...
|
||||||
|
|
||||||
|
bindata:
|
||||||
|
go-bindata -pkg logfile -o ./pkg/logfile/bindata_test.go ./pkg/logfile/test
|
||||||
|
|
||||||
container-build:
|
container-build:
|
||||||
docker run \
|
docker run \
|
||||||
--volume ${PWD}:/workspace \
|
--volume ${PWD}:/workspace \
|
||||||
|
@ -1,33 +1,26 @@
|
|||||||
package daemon
|
package daemon
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
|
||||||
"os"
|
|
||||||
"os/signal"
|
|
||||||
"syscall"
|
|
||||||
|
|
||||||
"github.com/volker-raschek/flucky/pkg/config"
|
"github.com/volker-raschek/flucky/pkg/config"
|
||||||
"github.com/volker-raschek/flucky/pkg/sensor"
|
|
||||||
"github.com/volker-raschek/flucky/pkg/types"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// Start the daemon
|
// Start the daemon
|
||||||
func Start(cnf *config.FluckyConfig) error {
|
func Start(cnf *config.Configuration) error {
|
||||||
|
|
||||||
interrupt := make(chan os.Signal, 1)
|
// interrupt := make(chan os.Signal, 1)
|
||||||
signal.Notify(interrupt, os.Interrupt, os.Kill, syscall.SIGTERM)
|
// signal.Notify(interrupt, os.Interrupt, os.Kill, syscall.SIGTERM)
|
||||||
|
|
||||||
humidityChannel := make(chan *types.Humidity)
|
// humidityChannel := make(chan *types.Humidity)
|
||||||
temperatureChannel := make(chan *types.Temperature)
|
// temperatureChannel := make(chan *types.Temperature)
|
||||||
|
|
||||||
go sensor.ReadHumiditiesContinuously(humiditySensors, humidityChannel)
|
// go sensor.ReadHumiditiesContinuously(humiditySensors, humidityChannel)
|
||||||
go sensor.ReadTemperaturesContinuously(temperatureSensors, temperatureChannel)
|
// go sensor.ReadTemperaturesContinuously(temperatureSensors, temperatureChannel)
|
||||||
|
|
||||||
for {
|
|
||||||
select {
|
|
||||||
case killSignal := <-interrupt:
|
|
||||||
return fmt.Errorf("Daemon was interruped by system signal %v", killSignal)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
// for {
|
||||||
|
// select {
|
||||||
|
// case killSignal := <-interrupt:
|
||||||
|
// return fmt.Errorf("Daemon was interruped by system signal %v", killSignal)
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
|
388
pkg/logfile/bindata_test.go
Normal file
388
pkg/logfile/bindata_test.go
Normal file
@ -0,0 +1,388 @@
|
|||||||
|
// Package logfile Code generated by go-bindata. (@generated) DO NOT EDIT.
|
||||||
|
// sources:
|
||||||
|
// pkg/logfile/test/faultyTemperatures_01.json
|
||||||
|
// pkg/logfile/test/faultyTemperatures_02.json
|
||||||
|
// pkg/logfile/test/faultyTemperatures_03.json
|
||||||
|
// pkg/logfile/test/faultyTemperatures_04.json
|
||||||
|
// pkg/logfile/test/faultyTemperatures_05.json
|
||||||
|
// pkg/logfile/test/validTemperatures_01.json
|
||||||
|
// pkg/logfile/test/validTemperatures_02.json
|
||||||
|
package logfile
|
||||||
|
|
||||||
|
import (
|
||||||
|
"bytes"
|
||||||
|
"compress/gzip"
|
||||||
|
"fmt"
|
||||||
|
"io"
|
||||||
|
"io/ioutil"
|
||||||
|
"os"
|
||||||
|
"path/filepath"
|
||||||
|
"strings"
|
||||||
|
"time"
|
||||||
|
)
|
||||||
|
|
||||||
|
func bindataRead(data []byte, name string) ([]byte, error) {
|
||||||
|
gz, err := gzip.NewReader(bytes.NewBuffer(data))
|
||||||
|
if err != nil {
|
||||||
|
return nil, fmt.Errorf("Read %q: %v", name, err)
|
||||||
|
}
|
||||||
|
|
||||||
|
var buf bytes.Buffer
|
||||||
|
_, err = io.Copy(&buf, gz)
|
||||||
|
clErr := gz.Close()
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
return nil, fmt.Errorf("Read %q: %v", name, err)
|
||||||
|
}
|
||||||
|
if clErr != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return buf.Bytes(), nil
|
||||||
|
}
|
||||||
|
|
||||||
|
type asset struct {
|
||||||
|
bytes []byte
|
||||||
|
info os.FileInfo
|
||||||
|
}
|
||||||
|
|
||||||
|
type bindataFileInfo struct {
|
||||||
|
name string
|
||||||
|
size int64
|
||||||
|
mode os.FileMode
|
||||||
|
modTime time.Time
|
||||||
|
}
|
||||||
|
|
||||||
|
// Name return file name
|
||||||
|
func (fi bindataFileInfo) Name() string {
|
||||||
|
return fi.name
|
||||||
|
}
|
||||||
|
|
||||||
|
// Size return file size
|
||||||
|
func (fi bindataFileInfo) Size() int64 {
|
||||||
|
return fi.size
|
||||||
|
}
|
||||||
|
|
||||||
|
// Mode return file mode
|
||||||
|
func (fi bindataFileInfo) Mode() os.FileMode {
|
||||||
|
return fi.mode
|
||||||
|
}
|
||||||
|
|
||||||
|
// Mode return file modify time
|
||||||
|
func (fi bindataFileInfo) ModTime() time.Time {
|
||||||
|
return fi.modTime
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsDir return file whether a directory
|
||||||
|
func (fi bindataFileInfo) IsDir() bool {
|
||||||
|
return fi.mode&os.ModeDir != 0
|
||||||
|
}
|
||||||
|
|
||||||
|
// Sys return file is sys mode
|
||||||
|
func (fi bindataFileInfo) Sys() interface{} {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
var _pkgLogfileTestFaultytemperatures_01Json = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x9c\x8f\xbb\x4e\xc3\x40\x10\x45\x7b\x7f\xc5\xc8\x2d\x4c\x34\x3b\xd9\xa7\xbf\x83\x0e\xa1\x68\x1f\x63\xc9\x92\x13\x47\x9b\x35\x0d\xe2\xdf\x51\x20\x14\x08\x17\x90\xd1\x94\xf7\x9c\xab\xfb\xdc\x01\xbc\x75\x00\xd0\x37\x39\x9e\xa5\xc6\xb6\x56\x39\x4c\xa5\x1f\xa0\x8f\xda\x06\x43\xfb\x84\x63\x56\x16\xb5\x38\x46\x5f\x38\xa0\x13\x11\x21\x9f\x62\x30\xae\x7f\xfc\x05\xbf\xc6\x79\x95\x2b\xcf\x7a\x67\x2c\x6f\x24\xc6\xba\x1c\x0f\x25\xb6\xaf\x14\xa9\x80\x8a\x90\xd4\x13\xd1\xf0\xf9\x3b\xfa\xbe\x07\xe2\x81\x68\x43\xd1\xa6\x79\xfe\xa9\x20\xf3\x07\xc5\x45\x4e\x97\xa5\xde\xf6\x79\x2d\x31\xb3\xf6\x68\x03\x3b\xd4\x25\x59\x4c\x76\x0c\xe8\x7c\x50\x59\xb8\xec\x49\xc9\x8d\xcb\x55\x62\x9b\x96\xd3\x1d\x95\xeb\xf9\xca\xfc\x6b\x6e\x07\xf0\xde\xbd\x7c\x04\x00\x00\xff\xff\xb0\x80\xd6\x81\x9b\x01\x00\x00")
|
||||||
|
|
||||||
|
func pkgLogfileTestFaultytemperatures_01JsonBytes() ([]byte, error) {
|
||||||
|
return bindataRead(
|
||||||
|
_pkgLogfileTestFaultytemperatures_01Json,
|
||||||
|
"pkg/logfile/test/faultyTemperatures_01.json",
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
func pkgLogfileTestFaultytemperatures_01Json() (*asset, error) {
|
||||||
|
bytes, err := pkgLogfileTestFaultytemperatures_01JsonBytes()
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
info := bindataFileInfo{name: "pkg/logfile/test/faultyTemperatures_01.json", size: 411, mode: os.FileMode(420), modTime: time.Unix(1560540507, 0)}
|
||||||
|
a := &asset{bytes: bytes, info: info}
|
||||||
|
return a, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
var _pkgLogfileTestFaultytemperatures_02Json = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x9c\x8f\xbb\x4e\xc3\x40\x10\x45\x7b\x7f\xc5\xc8\x2d\x4c\x34\x3b\xd9\xa7\xbf\x83\x0e\xa1\x68\x1f\x63\xc9\x92\x13\x47\x9b\x35\x0d\xe2\xdf\x51\x20\x14\x08\x17\x90\xd1\x94\xf7\x9c\xab\xfb\xdc\x01\xbc\x75\x00\xd0\x37\x39\x9e\xa5\xc6\xb6\x56\x39\x4c\xa5\x1f\xa0\x8f\xda\x06\x43\xfb\x84\x63\x56\x16\xb5\x38\x46\x5f\x38\xa0\x13\x11\x21\x9f\x62\x30\xae\x7f\xfc\x05\xbf\xc6\x79\x95\x2b\xcf\x7a\x67\x2c\x6f\x24\xc6\xba\x1c\x0f\x25\xb6\xaf\x14\xa9\x80\x64\x90\xd4\x13\xd1\xf0\xf9\x3b\xfa\xbe\x07\xe2\x81\x68\x43\xd1\xa6\x79\xfe\xa9\x50\xf4\x07\xc5\x45\x4e\x97\xa5\xde\xf6\x79\x2d\x31\xb3\xf6\x68\x03\x3b\xd4\x25\x59\x4c\x76\x0c\xe8\x7c\x50\x59\xb8\xec\x49\xc9\x8d\xcb\x55\x62\x9b\x96\xd3\x1d\x95\xeb\xf9\xca\xfc\x6b\x6e\x07\xf0\xde\xbd\x7c\x04\x00\x00\xff\xff\x3f\x32\xa5\x3a\x9b\x01\x00\x00")
|
||||||
|
|
||||||
|
func pkgLogfileTestFaultytemperatures_02JsonBytes() ([]byte, error) {
|
||||||
|
return bindataRead(
|
||||||
|
_pkgLogfileTestFaultytemperatures_02Json,
|
||||||
|
"pkg/logfile/test/faultyTemperatures_02.json",
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
func pkgLogfileTestFaultytemperatures_02Json() (*asset, error) {
|
||||||
|
bytes, err := pkgLogfileTestFaultytemperatures_02JsonBytes()
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
info := bindataFileInfo{name: "pkg/logfile/test/faultyTemperatures_02.json", size: 411, mode: os.FileMode(420), modTime: time.Unix(1560540283, 0)}
|
||||||
|
a := &asset{bytes: bytes, info: info}
|
||||||
|
return a, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
var _pkgLogfileTestFaultytemperatures_03Json = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x9c\x8f\x4d\x0e\x82\x30\x10\x85\xf7\x3d\xc5\xa4\x5b\x2d\x99\x56\x0a\x94\x73\xb8\x33\x86\x14\x18\x12\x12\xfe\x52\x5a\x37\xc6\xbb\x1b\x14\x17\x46\x16\xea\x64\x56\x93\xf7\x7d\x79\x73\x62\x00\x57\x06\x00\xdc\x53\x3f\x91\xb3\x3e\x38\x2a\xda\x9a\xe7\xc0\x6d\x9c\x18\x8d\x87\x52\x34\x95\x4c\x44\x4c\xa9\x12\x59\xad\x8c\x48\x89\x88\x30\x2b\xad\xd1\x29\xdf\x7f\xc0\x17\xdb\x05\x5a\x78\x15\x47\x3a\x51\x1b\x89\xc6\x8d\x7d\x51\x5b\xff\x4c\xa1\x34\x02\xb5\x40\x79\x44\xcc\x1f\x1b\xe1\x6b\x76\xa8\x72\xc4\x0d\x85\x6f\xbb\xee\x5d\x21\xf1\x0b\xc5\x4c\xc3\x3c\xba\xf5\xbf\xf5\x56\x39\xb2\xbe\x1d\x87\x3f\x1a\x85\x69\x61\x7e\xea\xc1\x00\x6e\xec\x7c\x0f\x00\x00\xff\xff\x80\x14\x1a\xb8\x77\x01\x00\x00")
|
||||||
|
|
||||||
|
func pkgLogfileTestFaultytemperatures_03JsonBytes() ([]byte, error) {
|
||||||
|
return bindataRead(
|
||||||
|
_pkgLogfileTestFaultytemperatures_03Json,
|
||||||
|
"pkg/logfile/test/faultyTemperatures_03.json",
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
func pkgLogfileTestFaultytemperatures_03Json() (*asset, error) {
|
||||||
|
bytes, err := pkgLogfileTestFaultytemperatures_03JsonBytes()
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
info := bindataFileInfo{name: "pkg/logfile/test/faultyTemperatures_03.json", size: 375, mode: os.FileMode(420), modTime: time.Unix(1560540363, 0)}
|
||||||
|
a := &asset{bytes: bytes, info: info}
|
||||||
|
return a, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
var _pkgLogfileTestFaultytemperatures_04Json = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x9c\x8f\xcb\x4a\xc4\x40\x10\x45\xf7\xfd\x15\x45\x6f\xb5\xa4\xba\xa7\xd3\x8f\x7c\x87\x3b\x91\xa1\x1f\x15\x08\x64\x26\x43\x4f\xc7\x8d\xf8\xef\x92\x10\x17\x62\x16\x6a\x51\xbb\xcb\x39\xdc\xfb\x22\x00\xde\x05\x00\xc8\xc6\x97\x1b\xd7\xd8\x96\xca\xe7\xb1\xc8\x1e\x64\x34\x36\x74\x74\x4a\x38\x64\x65\xd1\xb0\xd3\xe8\x8b\x0e\xe8\x98\x99\xc9\xa7\x18\x3a\x27\x1f\x7f\xc0\x6f\x71\x5a\x78\xe5\x0f\xb2\xa1\xce\x97\x73\x89\x6d\xcb\x35\xa9\x80\xd4\x21\xa9\x67\xa2\x7e\xfb\x27\xfa\xba\x07\xd2\x3d\xd1\x81\xa2\x8d\xd3\xf4\x5d\xa1\xe8\x17\x8a\x3b\x5f\xef\x73\xdd\x97\x79\xc3\x31\x6b\xe3\xd1\x06\xed\xd0\x94\x64\x31\xd9\x21\xa0\xf3\x41\x65\xd6\xe5\x44\x8a\x77\x2e\x57\x8e\x6d\x9c\xaf\xff\x68\xbd\xdc\x56\xe6\x4f\x5d\x05\xc0\x87\x78\xfd\x0c\x00\x00\xff\xff\xb4\x2d\x4b\xe4\x95\x01\x00\x00")
|
||||||
|
|
||||||
|
func pkgLogfileTestFaultytemperatures_04JsonBytes() ([]byte, error) {
|
||||||
|
return bindataRead(
|
||||||
|
_pkgLogfileTestFaultytemperatures_04Json,
|
||||||
|
"pkg/logfile/test/faultyTemperatures_04.json",
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
func pkgLogfileTestFaultytemperatures_04Json() (*asset, error) {
|
||||||
|
bytes, err := pkgLogfileTestFaultytemperatures_04JsonBytes()
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
info := bindataFileInfo{name: "pkg/logfile/test/faultyTemperatures_04.json", size: 405, mode: os.FileMode(420), modTime: time.Unix(1560540378, 0)}
|
||||||
|
a := &asset{bytes: bytes, info: info}
|
||||||
|
return a, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
var _pkgLogfileTestFaultytemperatures_05Json = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x9c\x8e\xcd\xaa\x83\x30\x10\x85\xf7\x79\x8a\x21\xdb\x7b\x23\x93\xdc\x18\x8d\xcf\x71\x77\xa5\x48\x34\x23\x08\xfe\x11\x63\x37\xa5\xef\x5e\x6c\xed\xa2\xd4\x45\xdb\x61\x76\xe7\x9c\x8f\xef\xc0\x00\xce\x0c\x00\x78\xa4\x7e\xa2\xe0\xe2\x12\xa8\x6c\x3d\x2f\x80\xf3\xdf\x97\xe0\xe4\xba\x85\xd6\x4c\xe9\x24\x35\x6a\xa7\xd1\x84\xb1\x2f\xbd\x8b\xf7\x16\x4a\x2b\x30\x15\x28\xff\x11\x8b\xdb\x27\xf8\xb8\x1f\x54\x05\xe2\x0e\x22\xb6\x5d\xf7\x8c\x90\xf8\x06\x62\xa6\x61\x1e\xc3\xe6\x9e\x6b\x72\xb5\xd2\xb9\x30\x56\x65\x42\xfb\xca\x88\xca\x34\x56\x64\xb9\x95\x35\x29\xff\x87\x92\xb6\x5d\x1d\xc8\xc5\x76\x1c\xbe\xb0\x5e\xa6\x75\xf3\x91\x2b\x03\xb8\xb0\xe3\x35\x00\x00\xff\xff\xf5\xbf\x40\x9a\x77\x01\x00\x00")
|
||||||
|
|
||||||
|
func pkgLogfileTestFaultytemperatures_05JsonBytes() ([]byte, error) {
|
||||||
|
return bindataRead(
|
||||||
|
_pkgLogfileTestFaultytemperatures_05Json,
|
||||||
|
"pkg/logfile/test/faultyTemperatures_05.json",
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
func pkgLogfileTestFaultytemperatures_05Json() (*asset, error) {
|
||||||
|
bytes, err := pkgLogfileTestFaultytemperatures_05JsonBytes()
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
info := bindataFileInfo{name: "pkg/logfile/test/faultyTemperatures_05.json", size: 375, mode: os.FileMode(420), modTime: time.Unix(1560540521, 0)}
|
||||||
|
a := &asset{bytes: bytes, info: info}
|
||||||
|
return a, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
var _pkgLogfileTestValidtemperatures_01Json = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xbc\x91\xcd\xaa\xdb\x30\x10\x85\xf7\x7e\x0a\xe1\x6d\x33\x61\x24\xcd\x68\x46\x7e\x8e\xee\x4a\x09\x92\x35\x86\x40\xfe\x70\x9c\x6e\x4a\xdf\xbd\x84\x86\xd2\xd0\xdc\x04\xb2\xb8\xfb\xf3\x9d\xc3\xe1\xfb\xd6\x39\xf7\xb3\x73\xce\xf5\x8b\xed\x4f\x36\x97\xe5\x32\xdb\x66\xdb\xfa\xc1\xf5\x85\x52\x66\x8c\x15\xa6\xd1\x27\x20\x93\x00\xda\x42\x06\x31\x33\x43\xad\x25\xb3\xf4\xab\xff\xe0\x1f\x65\x77\xb1\x2b\x1f\x68\xcd\x29\x3c\x48\x4c\xf3\x71\xbf\x69\x65\xf9\x93\x42\x9f\x01\x13\x78\xfa\x1a\xfc\xe0\x79\x08\xba\x66\x24\x64\xcf\xe4\xbf\x60\x18\x10\x1f\x54\x2c\xdb\xdd\xee\xa3\x0a\x1d\x50\xd6\x51\xc9\x23\x51\x8e\x77\x15\x67\x3b\x9c\x8f\xf3\xed\x9f\x92\x95\x31\x90\x42\xca\x41\x80\x5a\x4d\x50\xd3\x94\x41\x34\xfb\xd1\x42\x8b\xe8\xed\xc6\x8d\xb3\x95\x65\x7b\x3c\x3c\x9d\xa4\xc4\xaa\xac\x89\xee\x26\x2f\xa7\x2b\xf3\x12\x14\x94\x74\xe3\x3a\xe7\x7e\xad\x9e\x78\xe1\xc9\xfb\x5c\x4b\x84\x3a\x5a\x01\x1a\x63\x85\x52\x6a\x05\x24\x4c\x56\x04\x27\x31\xff\xc2\x4b\x14\x7e\xcb\x8b\x46\xe5\x44\x14\xdf\xf7\x42\x29\x6a\x8e\xf2\xf7\xec\x03\x2f\x36\x8d\x4d\x98\x0d\x34\x34\x0f\x24\x9a\xa1\x30\x56\x88\xcc\x55\x25\x72\xd5\xa6\x9f\xe7\x45\xd0\xff\xe3\xa5\x73\xdf\x7f\x07\x00\x00\xff\xff\xec\xd5\xa5\x99\x33\x03\x00\x00")
|
||||||
|
|
||||||
|
func pkgLogfileTestValidtemperatures_01JsonBytes() ([]byte, error) {
|
||||||
|
return bindataRead(
|
||||||
|
_pkgLogfileTestValidtemperatures_01Json,
|
||||||
|
"pkg/logfile/test/validTemperatures_01.json",
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
func pkgLogfileTestValidtemperatures_01Json() (*asset, error) {
|
||||||
|
bytes, err := pkgLogfileTestValidtemperatures_01JsonBytes()
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
info := bindataFileInfo{name: "pkg/logfile/test/validTemperatures_01.json", size: 819, mode: os.FileMode(420), modTime: time.Unix(1560540058, 0)}
|
||||||
|
a := &asset{bytes: bytes, info: info}
|
||||||
|
return a, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
var _pkgLogfileTestValidtemperatures_02Json = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xac\x91\x4d\x6a\xc3\x30\x10\x46\xf7\x3e\x85\xf0\xb6\x99\x30\x92\x66\xa4\x91\xcf\xd1\x5d\x29\x41\xb2\xc6\x10\x70\x7e\x70\xec\x6e\x4a\xef\x5e\x42\xb3\x09\x4d\x13\x08\xdd\xcf\x7b\x1f\xd2\x7b\x6b\x8c\xf9\x6c\x8c\x31\xed\xac\xbb\xa3\x4e\x79\x5e\x26\xdd\x6c\x6b\xdb\x99\x36\x53\x48\x8c\xbe\xc0\xd0\xdb\x00\xa4\xd1\x81\x54\x97\x20\xaa\xaa\xa2\x94\x9c\x38\xb6\xab\x5f\xf0\x47\x1e\x17\x3d\xf3\x8e\xd6\x1c\xdc\x8d\x8b\x61\x3a\xec\x36\x35\xcf\x3f\x57\x68\x13\x60\x00\x4b\xaf\xce\x76\x96\x3b\x27\x6b\x46\x42\xb6\x4c\xf6\x05\x5d\x87\x78\x43\x31\x6f\xc7\xf1\x2f\x85\x74\x18\xd7\x5e\xc8\x22\x51\xf2\x57\x8a\x93\xee\x4f\x87\xe9\xf2\x3e\x21\xcd\xbd\x23\x81\x90\x5c\x04\xaa\x25\x40\x09\x43\x82\x28\xc9\xf6\xea\xaa\x47\xab\x17\xae\x9f\x34\xcf\xdb\xc3\xfe\xee\x24\x05\x16\x61\x09\x74\x35\xb9\x1c\xcf\xcc\x43\x30\x62\x0c\x17\xae\x31\xe6\x6b\x75\xa7\x0b\x0f\xd6\xa6\x92\x3d\x94\x5e\x33\x50\xef\x0b\xe4\x5c\x0a\x20\x61\xd0\x1c\x71\x88\x6a\x1f\x74\xf1\x91\x9f\xea\x22\x5e\x38\x10\xf9\xa7\xba\xdc\x51\x5c\x75\xd1\xa1\xaf\x91\x59\x41\x5c\xb5\x40\x51\x12\x64\xc6\x02\x9e\xb9\x48\xf4\x5c\xa4\xca\x7f\x77\xd9\x2f\xe3\x78\xfe\xf7\xe6\xfd\x3b\x00\x00\xff\xff\x16\x06\x12\x62\x12\x03\x00\x00")
|
||||||
|
|
||||||
|
func pkgLogfileTestValidtemperatures_02JsonBytes() ([]byte, error) {
|
||||||
|
return bindataRead(
|
||||||
|
_pkgLogfileTestValidtemperatures_02Json,
|
||||||
|
"pkg/logfile/test/validTemperatures_02.json",
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
func pkgLogfileTestValidtemperatures_02Json() (*asset, error) {
|
||||||
|
bytes, err := pkgLogfileTestValidtemperatures_02JsonBytes()
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
info := bindataFileInfo{name: "pkg/logfile/test/validTemperatures_02.json", size: 786, mode: os.FileMode(420), modTime: time.Unix(1560540068, 0)}
|
||||||
|
a := &asset{bytes: bytes, info: info}
|
||||||
|
return a, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// Asset loads and returns the asset for the given name.
|
||||||
|
// It returns an error if the asset could not be found or
|
||||||
|
// could not be loaded.
|
||||||
|
func Asset(name string) ([]byte, error) {
|
||||||
|
cannonicalName := strings.Replace(name, "\\", "/", -1)
|
||||||
|
if f, ok := _bindata[cannonicalName]; ok {
|
||||||
|
a, err := f()
|
||||||
|
if err != nil {
|
||||||
|
return nil, fmt.Errorf("Asset %s can't read by error: %v", name, err)
|
||||||
|
}
|
||||||
|
return a.bytes, nil
|
||||||
|
}
|
||||||
|
return nil, fmt.Errorf("Asset %s not found", name)
|
||||||
|
}
|
||||||
|
|
||||||
|
// MustAsset is like Asset but panics when Asset would return an error.
|
||||||
|
// It simplifies safe initialization of global variables.
|
||||||
|
func MustAsset(name string) []byte {
|
||||||
|
a, err := Asset(name)
|
||||||
|
if err != nil {
|
||||||
|
panic("asset: Asset(" + name + "): " + err.Error())
|
||||||
|
}
|
||||||
|
|
||||||
|
return a
|
||||||
|
}
|
||||||
|
|
||||||
|
// AssetInfo loads and returns the asset info for the given name.
|
||||||
|
// It returns an error if the asset could not be found or
|
||||||
|
// could not be loaded.
|
||||||
|
func AssetInfo(name string) (os.FileInfo, error) {
|
||||||
|
cannonicalName := strings.Replace(name, "\\", "/", -1)
|
||||||
|
if f, ok := _bindata[cannonicalName]; ok {
|
||||||
|
a, err := f()
|
||||||
|
if err != nil {
|
||||||
|
return nil, fmt.Errorf("AssetInfo %s can't read by error: %v", name, err)
|
||||||
|
}
|
||||||
|
return a.info, nil
|
||||||
|
}
|
||||||
|
return nil, fmt.Errorf("AssetInfo %s not found", name)
|
||||||
|
}
|
||||||
|
|
||||||
|
// AssetNames returns the names of the assets.
|
||||||
|
func AssetNames() []string {
|
||||||
|
names := make([]string, 0, len(_bindata))
|
||||||
|
for name := range _bindata {
|
||||||
|
names = append(names, name)
|
||||||
|
}
|
||||||
|
return names
|
||||||
|
}
|
||||||
|
|
||||||
|
// _bindata is a table, holding each asset generator, mapped to its name.
|
||||||
|
var _bindata = map[string]func() (*asset, error){
|
||||||
|
"pkg/logfile/test/faultyTemperatures_01.json": pkgLogfileTestFaultytemperatures_01Json,
|
||||||
|
"pkg/logfile/test/faultyTemperatures_02.json": pkgLogfileTestFaultytemperatures_02Json,
|
||||||
|
"pkg/logfile/test/faultyTemperatures_03.json": pkgLogfileTestFaultytemperatures_03Json,
|
||||||
|
"pkg/logfile/test/faultyTemperatures_04.json": pkgLogfileTestFaultytemperatures_04Json,
|
||||||
|
"pkg/logfile/test/faultyTemperatures_05.json": pkgLogfileTestFaultytemperatures_05Json,
|
||||||
|
"pkg/logfile/test/validTemperatures_01.json": pkgLogfileTestValidtemperatures_01Json,
|
||||||
|
"pkg/logfile/test/validTemperatures_02.json": pkgLogfileTestValidtemperatures_02Json,
|
||||||
|
}
|
||||||
|
|
||||||
|
// AssetDir returns the file names below a certain
|
||||||
|
// directory embedded in the file by go-bindata.
|
||||||
|
// For example if you run go-bindata on data/... and data contains the
|
||||||
|
// following hierarchy:
|
||||||
|
// data/
|
||||||
|
// foo.txt
|
||||||
|
// img/
|
||||||
|
// a.png
|
||||||
|
// b.png
|
||||||
|
// then AssetDir("data") would return []string{"foo.txt", "img"}
|
||||||
|
// AssetDir("data/img") would return []string{"a.png", "b.png"}
|
||||||
|
// AssetDir("foo.txt") and AssetDir("notexist") would return an error
|
||||||
|
// AssetDir("") will return []string{"data"}.
|
||||||
|
func AssetDir(name string) ([]string, error) {
|
||||||
|
node := _bintree
|
||||||
|
if len(name) != 0 {
|
||||||
|
cannonicalName := strings.Replace(name, "\\", "/", -1)
|
||||||
|
pathList := strings.Split(cannonicalName, "/")
|
||||||
|
for _, p := range pathList {
|
||||||
|
node = node.Children[p]
|
||||||
|
if node == nil {
|
||||||
|
return nil, fmt.Errorf("Asset %s not found", name)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if node.Func != nil {
|
||||||
|
return nil, fmt.Errorf("Asset %s not found", name)
|
||||||
|
}
|
||||||
|
rv := make([]string, 0, len(node.Children))
|
||||||
|
for childName := range node.Children {
|
||||||
|
rv = append(rv, childName)
|
||||||
|
}
|
||||||
|
return rv, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
type bintree struct {
|
||||||
|
Func func() (*asset, error)
|
||||||
|
Children map[string]*bintree
|
||||||
|
}
|
||||||
|
|
||||||
|
var _bintree = &bintree{nil, map[string]*bintree{
|
||||||
|
"pkg": &bintree{nil, map[string]*bintree{
|
||||||
|
"logfile": &bintree{nil, map[string]*bintree{
|
||||||
|
"test": &bintree{nil, map[string]*bintree{
|
||||||
|
"faultyTemperatures_01.json": &bintree{pkgLogfileTestFaultytemperatures_01Json, map[string]*bintree{}},
|
||||||
|
"faultyTemperatures_02.json": &bintree{pkgLogfileTestFaultytemperatures_02Json, map[string]*bintree{}},
|
||||||
|
"faultyTemperatures_03.json": &bintree{pkgLogfileTestFaultytemperatures_03Json, map[string]*bintree{}},
|
||||||
|
"faultyTemperatures_04.json": &bintree{pkgLogfileTestFaultytemperatures_04Json, map[string]*bintree{}},
|
||||||
|
"faultyTemperatures_05.json": &bintree{pkgLogfileTestFaultytemperatures_05Json, map[string]*bintree{}},
|
||||||
|
"validTemperatures_01.json": &bintree{pkgLogfileTestValidtemperatures_01Json, map[string]*bintree{}},
|
||||||
|
"validTemperatures_02.json": &bintree{pkgLogfileTestValidtemperatures_02Json, map[string]*bintree{}},
|
||||||
|
}},
|
||||||
|
}},
|
||||||
|
}},
|
||||||
|
}}
|
||||||
|
|
||||||
|
// RestoreAsset restores an asset under the given directory
|
||||||
|
func RestoreAsset(dir, name string) error {
|
||||||
|
data, err := Asset(name)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
info, err := AssetInfo(name)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
err = os.MkdirAll(_filePath(dir, filepath.Dir(name)), os.FileMode(0755))
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
err = ioutil.WriteFile(_filePath(dir, name), data, info.Mode())
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
err = os.Chtimes(_filePath(dir, name), info.ModTime(), info.ModTime())
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// RestoreAssets restores an asset under the given directory recursively
|
||||||
|
func RestoreAssets(dir, name string) error {
|
||||||
|
children, err := AssetDir(name)
|
||||||
|
// File
|
||||||
|
if err != nil {
|
||||||
|
return RestoreAsset(dir, name)
|
||||||
|
}
|
||||||
|
// Dir
|
||||||
|
for _, child := range children {
|
||||||
|
err = RestoreAssets(dir, filepath.Join(name, child))
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func _filePath(dir, name string) string {
|
||||||
|
cannonicalName := strings.Replace(name, "\\", "/", -1)
|
||||||
|
return filepath.Join(append([]string{dir}, strings.Split(cannonicalName, "/")...)...)
|
||||||
|
}
|
7
pkg/logfile/logfile_test.go
Normal file
7
pkg/logfile/logfile_test.go
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
package logfile_test
|
||||||
|
|
||||||
|
import "testing"
|
||||||
|
|
||||||
|
func TestLogfile(t *testing.T) {
|
||||||
|
|
||||||
|
}
|
11
pkg/logfile/test/faultyTemperatures_01.json
Normal file
11
pkg/logfile/test/faultyTemperatures_01.json
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
[
|
||||||
|
{
|
||||||
|
"temperature_id": "a469503b-fc16-4e72-8d29-7eeee08ba957",
|
||||||
|
"temperature_value": "24.562",
|
||||||
|
"temperature_from_date": "2019-10-01T00:00:00.000000000+02:00",
|
||||||
|
"temperature_till_date": "2019-05-01T00:00:00.000000000+02:00",
|
||||||
|
"sensor_id": "84eac248-6927-4db6-b6f9-7891ce2d301e",
|
||||||
|
"creation_date": "2019-05-01T00:00:00.000000000+02:00",
|
||||||
|
"update_date": "2019-10-01T00:00:00.000000000+02:00"
|
||||||
|
}
|
||||||
|
]
|
11
pkg/logfile/test/faultyTemperatures_02.json
Normal file
11
pkg/logfile/test/faultyTemperatures_02.json
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
[
|
||||||
|
{
|
||||||
|
"temperature_id": "a469503b-fc16-4e72-8d29-7eeee08ba957",
|
||||||
|
"temperature_value": "24.562",
|
||||||
|
"temperature_from_date": "2019-05-01T00:00:00.000000000+02:00",
|
||||||
|
"temperature_till_date": "2019-10-01T00:00:00.000000000+02:00",
|
||||||
|
"sensor_id": "84eac248-6927-4db6-b6f9-7891ce2d301e",
|
||||||
|
"creation_date": "2019-10-01T00:00:00.000000000+02:00",
|
||||||
|
"update_date": "2019-05-01T00:00:00.000000000+02:00"
|
||||||
|
}
|
||||||
|
]
|
11
pkg/logfile/test/faultyTemperatures_03.json
Normal file
11
pkg/logfile/test/faultyTemperatures_03.json
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
[
|
||||||
|
{
|
||||||
|
"temperature_id": "a469503b-fc16-4e72-8d29-7eeee08ba957",
|
||||||
|
"temperature_value": "24.562",
|
||||||
|
"temperature_from_date": "2019-05-01T00:00:00.000000000+02:00",
|
||||||
|
"temperature_till_date": "2019-10-01T00:00:00.000000000+02:00",
|
||||||
|
"sensor_id": "",
|
||||||
|
"creation_date": "2019-05-01T00:00:00.000000000+02:00",
|
||||||
|
"update_date": "2019-10-01T00:00:00.000000000+02:00"
|
||||||
|
}
|
||||||
|
]
|
11
pkg/logfile/test/faultyTemperatures_04.json
Normal file
11
pkg/logfile/test/faultyTemperatures_04.json
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
[
|
||||||
|
{
|
||||||
|
"temperature_id": "a469503b-fc16-4e72-8d29-7eeee08ba957",
|
||||||
|
"temperature_value": "",
|
||||||
|
"temperature_from_date": "2019-05-01T00:00:00.000000000+02:00",
|
||||||
|
"temperature_till_date": "2019-10-01T00:00:00.000000000+02:00",
|
||||||
|
"sensor_id": "84eac248-6927-4db6-b6f9-7891ce2d301e",
|
||||||
|
"creation_date": "2019-05-01T00:00:00.000000000+02:00",
|
||||||
|
"update_date": "2019-10-01T00:00:00.000000000+02:00"
|
||||||
|
}
|
||||||
|
]
|
11
pkg/logfile/test/faultyTemperatures_05.json
Normal file
11
pkg/logfile/test/faultyTemperatures_05.json
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
[
|
||||||
|
{
|
||||||
|
"temperature_id": "",
|
||||||
|
"temperature_value": "24.562",
|
||||||
|
"temperature_from_date": "2019-05-01T00:00:00.000000000+02:00",
|
||||||
|
"temperature_till_date": "2019-10-01T00:00:00.000000000+02:00",
|
||||||
|
"sensor_id": "84eac248-6927-4db6-b6f9-7891ce2d301e",
|
||||||
|
"creation_date": "2019-05-01T00:00:00.000000000+02:00",
|
||||||
|
"update_date": "2019-10-01T00:00:00.000000000+02:00"
|
||||||
|
}
|
||||||
|
]
|
@ -1,20 +0,0 @@
|
|||||||
[
|
|
||||||
{
|
|
||||||
"temperature_id": "0975e0ab-7023-4d28-a5a4-fbd2d0111364",
|
|
||||||
"temperature_value": "24.562",
|
|
||||||
"temperature_from_date": "2019-06-14T20:48:44.184066823+02:00",
|
|
||||||
"temperature_till_date": "2019-06-14T20:48:44.184068854+02:00",
|
|
||||||
"sensor_id": "84eac248-6927-4db6-b6f9-7891ce2d301e",
|
|
||||||
"creation_date": "0001-01-01T00:00:00Z",
|
|
||||||
"update_date": "0001-01-01T00:00:00Z"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"temperature_id": "bfbcb239-28f2-413f-88b4-972d039ab9cd",
|
|
||||||
"temperature_value": "24.312",
|
|
||||||
"temperature_from_date": "2019-06-14T20:48:44.263861577+02:00",
|
|
||||||
"temperature_till_date": "2019-06-14T20:48:44.263863192+02:00",
|
|
||||||
"sensor_id": "efcd755e-82d1-4789-a50b-355b8735b8d8",
|
|
||||||
"creation_date": "0001-01-01T00:00:00Z",
|
|
||||||
"update_date": "0001-01-01T00:00:00Z"
|
|
||||||
}
|
|
||||||
]
|
|
20
pkg/logfile/test/validTemperatures_01.json
Normal file
20
pkg/logfile/test/validTemperatures_01.json
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
[
|
||||||
|
{
|
||||||
|
"temperature_id": "a469503b-fc16-4e72-8d29-7eeee08ba957",
|
||||||
|
"temperature_value": "24.562",
|
||||||
|
"temperature_from_date": "2019-06-14T21:15:28.504051541+02:00",
|
||||||
|
"temperature_till_date": "2019-06-14T21:18:07.384104493+02:00",
|
||||||
|
"sensor_id": "84eac248-6927-4db6-b6f9-7891ce2d301e",
|
||||||
|
"creation_date": "2019-06-14T21:18:07.465885864+02:00",
|
||||||
|
"update_date": "2019-06-14T21:18:07.46587076+02:00"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"temperature_id": "5f119ba3-bcea-4c3b-aabb-0406ea70f7e1",
|
||||||
|
"temperature_value": "24.375",
|
||||||
|
"temperature_from_date": "2019-06-14T21:15:28.583856443+02:00",
|
||||||
|
"temperature_till_date": "2019-06-14T21:18:07.463893776+02:00",
|
||||||
|
"sensor_id": "efcd755e-82d1-4789-a50b-355b8735b8d8",
|
||||||
|
"creation_date": "2019-06-14T21:18:07.465885864+02:00",
|
||||||
|
"update_date": "2019-06-14T21:18:07.46587701+02:00"
|
||||||
|
}
|
||||||
|
]
|
20
pkg/logfile/test/validTemperatures_02.json
Normal file
20
pkg/logfile/test/validTemperatures_02.json
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
[
|
||||||
|
{
|
||||||
|
"temperature_id": "a469503b-fc16-4e72-8d29-7eeee08ba957",
|
||||||
|
"temperature_value": "24.562",
|
||||||
|
"temperature_from_date": "2019-06-14T21:15:28.504051541+02:00",
|
||||||
|
"temperature_till_date": "2019-06-14T21:18:07.384104493+02:00",
|
||||||
|
"sensor_id": "84eac248-6927-4db6-b6f9-7891ce2d301e",
|
||||||
|
"creation_date": "2019-06-14T21:18:07.465885864+02:00",
|
||||||
|
"update_date": "2019-06-14T21:18:07.46587076+02:00"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"temperature_id": "5f119ba3-bcea-4c3b-aabb-0406ea70f7e1",
|
||||||
|
"temperature_value": "24.375",
|
||||||
|
"temperature_from_date": "2019-06-14T21:15:28.583856443+02:00",
|
||||||
|
"temperature_till_date": "2019-06-14T21:15:28.583856443+02:00",
|
||||||
|
"sensor_id": "efcd755e-82d1-4789-a50b-355b8735b8d8",
|
||||||
|
"creation_date": "2019-06-14T21:18:07.465885864+02:00",
|
||||||
|
"update_date": null
|
||||||
|
}
|
||||||
|
]
|
Loading…
Reference in New Issue
Block a user