Skip to content

Commit

Permalink
address oss feedback re: phrasing and tests
Browse files Browse the repository at this point in the history
  • Loading branch information
skpratt committed Feb 6, 2023
1 parent 3d68db7 commit 51e9ff0
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 15 deletions.
2 changes: 1 addition & 1 deletion agent/agent_endpoint_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4915,7 +4915,7 @@ func testAgent_RegisterServiceDeregisterService_Sidecar_UDP(t *testing.T, extraH
}
`,
enableACL: true,
policies: ``, // No token rules means no valid token
policies: ``, // No policies means no valid token
wantNS: nil,
wantErr: "Permission denied",
},
Expand Down
12 changes: 6 additions & 6 deletions agent/structs/aclfilter/filter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -505,13 +505,13 @@ func TestACL_filterHealthChecks(t *testing.T) {
service "foo" {
policy = "read"
}
service_prefix "foo" {
service_prefix "foo" {
policy = "read"
}
node "node1" {
policy = "read"
}
node_prefix "node1" {
node_prefix "node1" {
policy = "read"
}
`, nil, nil)
Expand All @@ -533,7 +533,7 @@ func TestACL_filterHealthChecks(t *testing.T) {
service "foo" {
policy = "read"
}
service_prefix "foo" {
service_prefix "foo" {
policy = "read"
}
`, nil, nil)
Expand All @@ -555,7 +555,7 @@ func TestACL_filterHealthChecks(t *testing.T) {
node "node1" {
policy = "read"
}
node_prefix "node1" {
node_prefix "node1" {
policy = "read"
}
`, nil, nil)
Expand Down Expand Up @@ -616,7 +616,7 @@ func TestACL_filterIntentions(t *testing.T) {
service "foo" {
policy = "read"
}
service_prefix "foo" {
service_prefix "foo" {
policy = "read"
}
`, nil, nil)
Expand Down Expand Up @@ -1623,7 +1623,7 @@ func TestACL_filterNodeDump(t *testing.T) {
node "" {
policy = "read"
},
node_prefix "" {
node_prefix "" {
policy = "read"
}
`, nil, nil)
Expand Down
26 changes: 18 additions & 8 deletions api/api_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -908,14 +908,6 @@ func TestAPI_Headers(t *testing.T) {
require.Error(t, err)
require.Equal(t, "application/octet-stream", request.Header.Get("Content-Type"))

_, err = c.ACL().RulesTranslate(strings.NewReader(`
agent "" {
policy = "read"
}
`))
// Legacy ACL support is deprecated.
require.Error(t, err)

_, _, err = c.Event().Fire(&UserEvent{
Name: "test",
Payload: []byte("foo"),
Expand All @@ -924,6 +916,24 @@ func TestAPI_Headers(t *testing.T) {
require.Equal(t, "application/octet-stream", request.Header.Get("Content-Type"))
}

func TestAPI_Deprecated(t *testing.T) {
t.Parallel()
c, s := makeClientWithConfig(t, func(c *Config) {
transport := http.DefaultTransport.(*http.Transport).Clone()
c.Transport = transport
}, nil)
defer s.Stop()
// Rules translation functionality was completely removed in Consul 1.15.
_, err := c.ACL().RulesTranslate(strings.NewReader(`
agent "" {
policy = "read"
}
`))
require.Error(t, err)
_, err = c.ACL().RulesTranslateToken("")
require.Error(t, err)
}

func TestAPI_RequestToHTTP(t *testing.T) {
t.Parallel()
c, s := makeClient(t)
Expand Down

0 comments on commit 51e9ff0

Please sign in to comment.