update config for fastexact, gzip decompress fastexact at parse time

This commit is contained in:
Bel LaPointe
2022-01-27 15:22:04 -07:00
parent bbe4c4b6ae
commit a742433a56
4 changed files with 61 additions and 0 deletions

View File

@@ -3,11 +3,47 @@ package broker
import (
"local/storage"
"local/truckstop/config"
"os"
"path"
"testing"
"golang.org/x/time/rate"
)
func TestFastExactReal(t *testing.T) {
if os.Getenv("INTEGRATION_FAST_EXACT") == "" {
t.Skip("$INTEGRATION_FAST_EXACT not set")
}
os.Setenv("CONFIG", "../config.json")
if err := config.Refresh(nil); err != nil {
t.Fatal(err)
}
conf := config.Get()
conf.Storage = []string{"files", path.Join(t.TempDir(), "storage")}
os.Setenv("CONFIG", path.Join(t.TempDir(), "config.json"))
config.Set(*conf)
if err := config.Refresh(nil); err != nil {
t.Fatal(err)
}
states := []config.State{
config.State("NC"),
}
fe := NewFastExact()
if err := fe.login(); err != nil {
t.Fatal(err)
}
jobs, err := fe.search(states)
if err != nil {
t.Fatal(err)
}
t.Logf("%d", len(jobs))
for i := range jobs {
t.Logf("[%d] %+v", i, jobs[i])
}
}
func TestFastExactLogin(t *testing.T) {
limiter = rate.NewLimiter(rate.Limit(60.0), 1)
fe := NewFastExact().WithMock()