Skip to content

Commit

Permalink
plugins/discovery: Fix log drop checking flaky test (open-policy-agen…
Browse files Browse the repository at this point in the history
…t#3360)

The test that checks for log drops was utilizing the
test server and would fail sporadically from an unmarshalling
error in the test server.

This change updates the test to not use the test server as
it's not required to meet the goal of the test.

Signed-off-by: Ashutosh Narkar <[email protected]>
  • Loading branch information
ashutosh-narkar authored Apr 9, 2021
1 parent e3cbe8c commit 64e91ff
Showing 1 changed file with 9 additions and 13 deletions.
22 changes: 9 additions & 13 deletions plugins/discovery/discovery_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -999,10 +999,6 @@ func TestStatusUpdatesTimestamp(t *testing.T) {

func TestStatusMetricsForLogDrops(t *testing.T) {

ts := testServer{t: t}
ts.Start()
defer ts.Stop()

logLevel := logrus.GetLevel()
defer logrus.SetLevel(logLevel)

Expand All @@ -1013,14 +1009,14 @@ func TestStatusMetricsForLogDrops(t *testing.T) {

ctx := context.Background()

manager, err := plugins.New([]byte(fmt.Sprintf(`{
"services": {
"localhost": {
"url": %q
}
},
"discovery": {"name": "config"}
}`, ts.server.URL)), "test-id", inmem.New())
manager, err := plugins.New([]byte(`{
"services": {
"localhost": {
"url": "http://localhost:9999"
}
},
"discovery": {"name": "config"},
}`), "test-id", inmem.New())
if err != nil {
t.Fatal(err)
}
Expand Down Expand Up @@ -1095,7 +1091,7 @@ func TestStatusMetricsForLogDrops(t *testing.T) {
// trigger a status update
disco.oneShot(ctx, download.Update{ETag: "etag-1", Bundle: makeDataBundle(1, `{
"config": {
"bundle": {"name": "test1"}
"bundles": {"test-bundle": {"service": "localhost"}}
}
}`)})

Expand Down

0 comments on commit 64e91ff

Please sign in to comment.