Merge pull request #8074 from hashicorp/dnephin/remove-references-to-PatchSliceOfMaps

Update comments that reference PatchSliceOfMaps
This commit is contained in:
Daniel Nephin 2020-06-15 14:33:10 -04:00 committed by GitHub
commit 2eac5b8023
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 8 additions and 24 deletions

View File

@ -2499,8 +2499,8 @@ func TestConfigFlagsAndEdgecases(t *testing.T) {
}, },
{ {
// This tests that we correct added the nested paths to arrays of objects // Test that slices in structured config are preserved by
// to the exceptions in PatchSliceOfMaps in config.go (for single service) // decode.HookWeakDecodeFromSlice.
desc: "service.connectsidecar_service with checks and upstreams", desc: "service.connectsidecar_service with checks and upstreams",
args: []string{ args: []string{
`-data-dir=` + dataDir, `-data-dir=` + dataDir,
@ -2628,8 +2628,8 @@ func TestConfigFlagsAndEdgecases(t *testing.T) {
}, },
}, },
{ {
// This tests that we correct added the nested paths to arrays of objects // Test that slices in structured config are preserved by
// to the exceptions in PatchSliceOfMaps in config.go (for service*s*) // decode.HookWeakDecodeFromSlice.
desc: "services.connect.sidecar_service with checks and upstreams", desc: "services.connect.sidecar_service with checks and upstreams",
args: []string{ args: []string{
`-data-dir=` + dataDir, `-data-dir=` + dataDir,

View File

@ -524,13 +524,8 @@ func (s *Server) makeUpstreamClustersForDiscoveryChain(
// arbitrary proto3 json format string or an error if it's invalid. // arbitrary proto3 json format string or an error if it's invalid.
// //
// For now we only support embedding in JSON strings because of the hcl parsing // For now we only support embedding in JSON strings because of the hcl parsing
// pain (see config.go comment above call to PatchSliceOfMaps). Until we // pain (see Background section in the comment for decode.HookWeakDecodeFromSlice).
// refactor config parser a _lot_ user's opaque config that contains arrays will // This may be fixed in decode.HookWeakDecodeFromSlice in the future.
// be mangled. We could actually fix that up in mapstructure which knows the
// type of the target so could resolve the slices to singletons unambiguously
// and it would work for us here... but we still have the problem that the
// config would render incorrectly in general in our HTTP API responses so we
// really need to fix it "properly".
// //
// When we do that we can support just nesting the config directly into the // When we do that we can support just nesting the config directly into the
// JSON/hcl naturally but this is a stop-gap that gets us an escape hatch // JSON/hcl naturally but this is a stop-gap that gets us an escape hatch

View File

@ -355,13 +355,8 @@ func makeListener(name, addr string, port int) *envoy.Listener {
// arbitrary proto3 json format string or an error if it's invalid. // arbitrary proto3 json format string or an error if it's invalid.
// //
// For now we only support embedding in JSON strings because of the hcl parsing // For now we only support embedding in JSON strings because of the hcl parsing
// pain (see config.go comment above call to PatchSliceOfMaps). Until we // pain (see Background section in the comment for decode.HookWeakDecodeFromSlice).
// refactor config parser a _lot_ user's opaque config that contains arrays will // This may be fixed in decode.HookWeakDecodeFromSlice in the future.
// be mangled. We could actually fix that up in mapstructure which knows the
// type of the target so could resolve the slices to singletons unambiguously
// and it would work for us here... but we still have the problem that the
// config would render incorrectly in general in our HTTP API responses so we
// really need to fix it "properly".
// //
// When we do that we can support just nesting the config directly into the // When we do that we can support just nesting the config directly into the
// JSON/hcl naturally but this is a stop-gap that gets us an escape hatch // JSON/hcl naturally but this is a stop-gap that gets us an escape hatch

View File

@ -55,12 +55,6 @@ There are four specific cases covered with increasing complexity:
state for client agent's RPC client. state for client agent's RPC client.
- [ ] Add a test to `agent/agent_test.go` similar to others with prefix - [ ] Add a test to `agent/agent_test.go` similar to others with prefix
`TestAgent_reloadConfig*`. `TestAgent_reloadConfig*`.
- [ ] **If** the new config field(s) include an array of structs or maps.
- [ ] Add the path to the call to `lib.PatchSliceOfMaps` in Parse in
`agent/config/config.go`.
- [ ] If none of the tests in `agent/config/runtime_test.go` failed before you did that,
then you didn't actually test the slice part yet, go back and add tests
that populate that slice.
- [ ] Add documentation to `website/source/docs/agent/options.html.md`. - [ ] Add documentation to `website/source/docs/agent/options.html.md`.
Done! You can now use your new field in a client agent by accessing Done! You can now use your new field in a client agent by accessing