Fix some broken code in master

There were several PRs that while all passed CI independently, when they all got merged into the same branch caused compilation errors in test code.

The main changes that caused issues where changing agent/cache.Cache.New to require a concrete options struct instead of a pointer. This broke the cert monitor tests and the catalog_list_services_test.go. Another change was made to unembed the http.Server from the agent.HTTPServer struct. That coupled with another change to add a test to ensure cache rate limiting coming from HTTP requests was working as expected caused compilation failures.
This commit is contained in:
Matt Keeler 2020-07-28 09:50:10 -04:00
parent 505de6dc29
commit 83d09de230
No known key found for this signature in database
GPG Key ID: 04DBAE1857E0081B
3 changed files with 7 additions and 7 deletions

View File

@ -912,7 +912,7 @@ func TestCacheRateLimit(test *testing.T) {
require.NoError(t, err)
resp := httptest.NewRecorder()
a.srv.Handler.ServeHTTP(resp, req)
a.srv.handler(false).ServeHTTP(resp, req)
// Key doesn't actually exist so we should get 404
if got, want := resp.Code, http.StatusOK; got != want {
t.Fatalf("bad response code got %d want %d", got, want)

View File

@ -82,7 +82,7 @@ func TestCatalogListServices_IntegrationWithCache_NotModifiedResponse(t *testing
reply.NotModified = true
})
c := cache.New(nil)
c := cache.New(cache.Options{})
c.RegisterType(CatalogListServicesName, typ)
last := cache.FetchResult{
Value: &structs.IndexedServices{

View File

@ -633,7 +633,7 @@ func TestCertMonitor_New_Errors(t *testing.T) {
},
"no-tls-configurator": {
cfg: Config{
Cache: cache.New(nil),
Cache: cache.New(cache.Options{}),
Fallback: fallback,
Tokens: tokens,
Datacenter: "foo",
@ -643,7 +643,7 @@ func TestCertMonitor_New_Errors(t *testing.T) {
},
"no-fallback": {
cfg: Config{
Cache: cache.New(nil),
Cache: cache.New(cache.Options{}),
TLSConfigurator: testTLSConfigurator(t),
Tokens: tokens,
Datacenter: "foo",
@ -653,7 +653,7 @@ func TestCertMonitor_New_Errors(t *testing.T) {
},
"no-tokens": {
cfg: Config{
Cache: cache.New(nil),
Cache: cache.New(cache.Options{}),
TLSConfigurator: testTLSConfigurator(t),
Fallback: fallback,
Datacenter: "foo",
@ -663,7 +663,7 @@ func TestCertMonitor_New_Errors(t *testing.T) {
},
"no-datacenter": {
cfg: Config{
Cache: cache.New(nil),
Cache: cache.New(cache.Options{}),
TLSConfigurator: testTLSConfigurator(t),
Fallback: fallback,
Tokens: tokens,
@ -673,7 +673,7 @@ func TestCertMonitor_New_Errors(t *testing.T) {
},
"no-node-name": {
cfg: Config{
Cache: cache.New(nil),
Cache: cache.New(cache.Options{}),
TLSConfigurator: testTLSConfigurator(t),
Fallback: fallback,
Tokens: tokens,