Skip to content

Commit

Permalink
test: increase coverage of eskipfile package to >80% (#2289)
Browse files Browse the repository at this point in the history
Signed-off-by: Sandor Szuecs <[email protected]>
  • Loading branch information
szuecs authored May 4, 2023
1 parent 7d04bfe commit 7e8c9dc
Showing 1 changed file with 39 additions and 0 deletions.
39 changes: 39 additions & 0 deletions eskipfile/file_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
package eskipfile

import (
"testing"

"github.com/zalando/skipper/eskip"
)

func TestOpenAndLoadAndParseAll(t *testing.T) {
f, err := Open("fixtures/test.eskip")
if err != nil {
t.Fatal(err)
}

ris, err := f.LoadAndParseAll()
if err != nil {
t.Fatal(err)
}
for _, ri := range ris {
if ri.ParseError != nil {
t.Fatal(err)
}
}

check := func(routeInfos []*eskip.RouteInfo, id, path string) {
for _, ri := range routeInfos {
if ri.Id == id {
if ri.Path != path {
t.Fatalf("Failed to find %q != %q", ri.Path, path)
}
return
}
}
t.Fatalf("Failed to find expected route with id %q and path %q", id, path)
}

check(ris, "foo", "/foo")
check(ris, "bar", "/bar")
}

0 comments on commit 7e8c9dc

Please sign in to comment.