Skip to content

Commit

Permalink
fix: increase coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
alok committed Dec 14, 2021
1 parent d1500e7 commit c57ed7c
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 12 deletions.
30 changes: 18 additions & 12 deletions modules/repo/fsrepo/fsrepo_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,23 +124,29 @@ func TestRepo(t *testing.T) {
t.Fatal("expected to find mounted datastore")
}

verifyMounts := func(mnts []fsrepo.MountInfo) {
if len(mnts) != 2 {
t.Fatal("expected 2 mounts found", len(mnts))
}

for _, v := range mnts {
if v.Path != ".testrepo/kv" && v.Path != ".testrepo/blocks" {
t.Fatal("unexpected paths", v.Path)
}
if v.Prefix != "/" && v.Prefix != "/blocks" {
t.Fatal("unexpected prefixes", v.Prefix)
}
}
}

mntInfo, err := mds.Mounts()
if err != nil {
t.Fatal(err)
}
verifyMounts(mntInfo)

if len(mntInfo) != 2 {
t.Fatal("expected 2 mounts found", len(mntInfo))
}

for _, v := range mntInfo {
if v.Path != ".testrepo/kv" && v.Path != ".testrepo/blocks" {
t.Fatal("unexpected paths", v.Path)
}
if v.Prefix != "/" && v.Prefix != "/blocks" {
t.Fatal("unexpected prefixes", v.Prefix)
}
}
mntInfo2 := r.Status().(map[string]interface{})["On-disk Mounts"].([]fsrepo.MountInfo)
verifyMounts(mntInfo2)

cfg.Set("TestAdd", "some value")
err = r.SetConfig(cfg)
Expand Down
24 changes: 24 additions & 0 deletions modules/repo/inmem/inmem_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,18 @@ func TestInmemRepo(t *testing.T) {
t.Fatal(err)
}

if r.Datastore() == nil {
t.Fatal("datastore not found")
}

if r.Store() == nil {
t.Fatal("store not found")
}

if r.Status().(string) != "In-mem repository" {
t.Fatal("invalid status")
}

err = r.Close()
if err != nil {
t.Fatal(err)
Expand Down Expand Up @@ -50,6 +62,18 @@ func TestInmemRepo(t *testing.T) {
t.Fatal("expected config to be different")
}

if r.Datastore() == nil {
t.Fatal("datastore not found")
}

if r.Store() == nil {
t.Fatal("store not found")
}

if r.Status().(string) != "In-mem repository" {
t.Fatal("invalid status")
}

err = r.Close()
if err != nil {
t.Fatal(err)
Expand Down
1 change: 1 addition & 0 deletions msuite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -383,6 +383,7 @@ func TestServices(t *testing.T) {
msuite.WithGRPCTCPListener(10000),
msuite.WithHTTP(10001),
msuite.WithPrometheus(true),
msuite.WithDebug(),
msuite.WithStaticDiscovery(map[string]string{
"svc1": "IP1",
"svc2": "IP2",
Expand Down

0 comments on commit c57ed7c

Please sign in to comment.