change dma to dbm

This commit is contained in:
Adrian Zürcher
2025-04-29 08:32:06 +02:00
parent fd835b67dc
commit c1d822b296
3 changed files with 37 additions and 37 deletions

View File

@@ -7,12 +7,12 @@ import (
"testing"
"time"
"github.com/zuadi/tecamino-dbm/args"
"github.com/zuadi/tecamino-dbm/cert"
"github.com/zuadi/tecamino-dbm/dbm"
"github.com/zuadi/tecamino-dbm/models"
"github.com/zuadi/tecamino-dbm/server"
"github.com/zuadi/tecamino-dbm/utils"
"github.com/tecamino/tecamino-dbm/args"
"github.com/tecamino/tecamino-dbm/cert"
"github.com/tecamino/tecamino-dbm/dbm"
"github.com/tecamino/tecamino-dbm/models"
"github.com/tecamino/tecamino-dbm/server"
"github.com/tecamino/tecamino-dbm/utils"
)
func TestCreateDps(t *testing.T) {
@@ -27,7 +27,7 @@ func TestCreateDps(t *testing.T) {
KeyFile: "./cert/key.pem",
},
RootDir: ".",
DMAFile: "Test",
DBMFile: "Test",
Debug: false,
})
if err != nil {
@@ -39,18 +39,18 @@ func TestCreateDps(t *testing.T) {
ndps := utils.ListofA2ZZ()
l := len(ndps)
s := time.Now()
for _, dp := range ndps {
for i := 0; i < 100; i++ {
err = dmaHandler.ImportDatapoints(&models.Datapoint{
Path: fmt.Sprintf("Test:%s:%03d", dp, i),
Type: RandomType(),
Value: rand.Int31(),
})
if err != nil {
t.Fatal(err)
}
}
}
// for _, dp := range ndps {
// for i := 0; i < 100; i++ {
// err = dmaHandler.ImportDatapoints(&models.Datapoint{
// Path: fmt.Sprintf("Test:%s:%03d", dp, i),
// Type: models.RandomType(),
// Value: rand.Int31(),
// })
// if err != nil {
// t.Fatal(err)
// }
// }
// }
fmt.Printf("time used to create %d datapoints: %v\n", l*100, time.Since(s))
var m runtime.MemStats
@@ -80,7 +80,7 @@ func TestQuery(t *testing.T) {
KeyFile: "./cert/key.pem",
},
RootDir: ".",
DMAFile: "Test",
DBMFile: "Test",
Debug: false,
})
if err != nil {
@@ -109,7 +109,7 @@ func TestUpdateDps(t *testing.T) {
KeyFile: "./cert/key.pem",
},
RootDir: ".",
DMAFile: "Test",
DBMFile: "Test",
Debug: false,
})
if err != nil {
@@ -121,17 +121,17 @@ func TestUpdateDps(t *testing.T) {
ndps := utils.ListofA2ZZ()
l := len(ndps)
s := time.Now()
for j, dp := range ndps {
if j > 2 {
break
}
for i := 0; i < 100; i++ {
err = dmaHandler.UpdateDatapointValue(fmt.Sprintf("Test:%s:%03d", dp, i), rand.Int31())
if err != nil {
t.Fatal(err)
}
}
}
// for j, dp := range ndps {
// if j > 2 {
// break
// }
// for i := 0; i < 100; i++ {
// err = dmaHandler.UpdateDatapointValue(fmt.Sprintf("Test:%s:%03d", dp, i), rand.Int31())
// if err != nil {
// t.Fatal(err)
// }
// }
// }
fmt.Printf("time used to update %d datapoints: %v\n", l*100, time.Since(s))
time.Sleep(5 * time.Second)