open-nomad/jobspec/test-fixtures
Derek Strickland 80b6f27efd
api: remove `mapstructure` tags from`Port` struct (#12916)
This PR solves a defect in the deserialization of api.Port structs when returning structs from theEventStream.

Previously, the api.Port struct's fields were decorated with both mapstructure and hcl tags to support the network.port stanza's use of the keyword static when posting a static port value. This works fine when posting a job and when retrieving any struct that has an embedded api.Port instance as long as the value is deserialized using JSON decoding. The EventStream, however, uses mapstructure to decode event payloads in the api package. mapstructure expects an underlying field named static which does not exist. The result was that the Port.Value field would always be set to 0.

Upon further inspection, a few things became apparent.

The struct already has hcl tags that support the indirection during job submission.
Serialization/deserialization with both the json and hcl packages produce the desired result.
The use of of the mapstructure tags provided no value as the Port struct contains only fields with primitive types.
This PR:

Removes the mapstructure tags from the api.Port structs
Updates the job parsing logic to use hcl instead of mapstructure when decoding Port instances.
Closes #11044

Co-authored-by: DerekStrickland <dstrickland@hashicorp.com>
Co-authored-by: Piotr Kazmierczak <470696+pkazmierczak@users.noreply.github.com>
2022-11-08 11:26:28 +01:00
..
artifacts.hcl jobspec: allow artifact headers in HCLv1 (#14637) 2022-09-27 12:18:49 -04:00
bad-artifact.hcl chore: Format hcl configurations 2019-07-20 16:55:07 +02:00
bad-ports.hcl run "make hclfmt" 2020-02-03 12:15:53 -05:00
basic.hcl template: error on missing key (#15141) 2022-11-04 13:23:01 -04:00
basic_wrong_key.hcl run "make hclfmt" 2020-02-03 12:15:53 -05:00
consul-namespace.hcl Parse `job > group > consul` block in HCL1 (#11423) 2021-11-03 13:49:32 -04:00
csi-plugin.hcl CSI: make plugin health_timeout configurable in csi_plugin stanza (#13340) 2022-06-14 10:04:16 -04:00
default-job.hcl jobspec: defaults 2015-09-14 18:34:26 -07:00
distinctHosts-constraint.hcl chore: Format hcl configurations 2019-07-20 16:55:07 +02:00
distinctProperty-constraint.hcl chore: Format hcl configurations 2019-07-20 16:55:07 +02:00
incorrect-service-def.hcl run "make hclfmt" 2020-02-03 12:15:53 -05:00
job-with-kill-signal.hcl chore: Format hcl configurations 2019-07-20 16:55:07 +02:00
migrate-job.hcl chore: Format hcl configurations 2019-07-20 16:55:07 +02:00
multi-network.hcl chore: Format hcl configurations 2019-07-20 16:55:07 +02:00
multi-resource.hcl chore: Format hcl configurations 2019-07-20 16:55:07 +02:00
multi-vault.hcl chore: initial hclfmt 2019-10-11 14:00:05 +02:00
multiregion.hcl multiregion: change AutoRevert to OnFailure 2020-06-17 11:05:45 -04:00
overlapping-ports.hcl run "make hclfmt" 2020-02-03 12:15:53 -05:00
parameterized_job.hcl chore: initial hclfmt 2019-10-11 14:00:05 +02:00
parse-ports.hcl api: remove `mapstructure` tags from`Port` struct (#12916) 2022-11-08 11:26:28 +01:00
periodic-cron.hcl chore: initial hclfmt 2019-10-11 14:00:05 +02:00
regexp-constraint.hcl chore: initial hclfmt 2019-10-11 14:00:05 +02:00
reschedule-job-unlimited.hcl chore: initial hclfmt 2019-10-11 14:00:05 +02:00
reschedule-job.hcl chore: initial hclfmt 2019-10-11 14:00:05 +02:00
resources-cores.hcl hcl: add new cores resources field 2021-07-26 11:45:10 -04:00
service-check-bad-header-2.hcl chore: initial hclfmt 2019-10-11 14:00:05 +02:00
service-check-bad-header.hcl chore: initial hclfmt 2019-10-11 14:00:05 +02:00
service-check-driver-address.hcl chore: initial hclfmt 2019-10-11 14:00:05 +02:00
service-check-initial-status.hcl chore: initial hclfmt 2019-10-11 14:00:05 +02:00
service-check-pass-fail.hcl consul: grrrrr hclfmt test resource file 2020-08-10 14:08:09 -05:00
service-check-restart.hcl chore: initial hclfmt 2019-10-11 14:00:05 +02:00
service-enable-tag-override.hcl Update consul-template to v0.24.1 and remove deprecated vault_grace (#7170) 2020-02-23 16:24:53 +01:00
service-meta.hcl chore: initial hclfmt 2019-10-11 14:00:05 +02:00
service-provider.hcl hcl1: add service block provider parameter. 2022-03-14 10:00:53 +01:00
service-tagged-address.hcl docs: add docs and tests for tagged_addresses 2022-05-31 13:02:48 -05:00
set-contains-constraint.hcl chore: initial hclfmt 2019-10-11 14:00:05 +02:00
specify-job.hcl chore: initial hclfmt 2019-10-11 14:00:05 +02:00
task-nested-config.hcl Implement configuration validation for all task drivers 2016-04-10 00:42:57 +02:00
task-scaling-policy-invalid-resource.hcl added new policy capabilities for recommendations API 2020-10-28 14:32:16 +00:00
task-scaling-policy-invalid-type.hcl added new policy capabilities for recommendations API 2020-10-28 14:32:16 +00:00
task-scaling-policy-missing-name.hcl added new policy capabilities for recommendations API 2020-10-28 14:32:16 +00:00
task-scaling-policy-multi-cpu.hcl added new policy capabilities for recommendations API 2020-10-28 14:32:16 +00:00
task-scaling-policy-multi-name.hcl added new policy capabilities for recommendations API 2020-10-28 14:32:16 +00:00
task-scaling-policy.hcl added new policy capabilities for recommendations API 2020-10-28 14:32:16 +00:00
tg-network-with-hostname.hcl allow configuration of Docker hostnames in bridge mode (#11173) 2021-09-16 08:13:09 +02:00
tg-network.hcl hclv1: parse service upstreams 2021-07-22 16:06:48 -04:00
tg-scaling-policy-invalid-type.hcl added new policy capabilities for recommendations API 2020-10-28 14:32:16 +00:00
tg-scaling-policy-minimal.hcl better testing of scaling parsing, fixed some broken tests by api 2020-07-04 19:32:37 +00:00
tg-scaling-policy-missing-max.hcl better testing of scaling parsing, fixed some broken tests by api 2020-07-04 19:32:37 +00:00
tg-scaling-policy-multi-policy.hcl ci: add a linting check for HCL files (#7791) 2020-04-23 14:32:44 -04:00
tg-scaling-policy-with-label.hcl added new policy capabilities for recommendations API 2020-10-28 14:32:16 +00:00
tg-scaling-policy.hcl hclv2 tests: test complex config configuration 2020-10-26 16:20:41 -04:00
tg-service-check-expose.hcl hclfmt test fixtures (#7584) 2020-04-01 10:48:28 -04:00
tg-service-check.hcl parse service check body 2021-07-22 16:06:48 -04:00
tg-service-connect-gateway-ingress.hcl adding support for customized ingress tls (#13184) 2022-06-02 18:43:58 -04:00
tg-service-connect-gateway-mesh.hcl support gateway mesh 2021-07-22 17:10:59 -04:00
tg-service-connect-gateway-terminating.hcl add a test for envoy_dns_discovery_type 2021-07-22 16:06:48 -04:00
tg-service-connect-local-service.hcl ci: add a linting check for HCL files (#7791) 2020-04-23 14:32:44 -04:00
tg-service-connect-native.hcl consul/connect: split connect native flag and task in service 2020-06-23 10:22:22 -05:00
tg-service-connect-proxy.hcl ci: add a linting check for HCL files (#7791) 2020-04-23 14:32:44 -04:00
tg-service-connect-resources.hcl connect: fix bug where sidecar_task.resources was ignored with hcl1 2022-01-25 10:17:54 -06:00
tg-service-connect-sidecar_disablecheck.hcl Support disabling TCP checks for connect sidecar services 2021-05-07 12:10:26 -04:00
tg-service-connect-sidecar_task-name.hcl hclv1: tweak HCLv1 tests 2020-10-21 14:05:46 -04:00
tg-service-enable-tag-override.hcl Update consul-template to v0.24.1 and remove deprecated vault_grace (#7170) 2020-02-23 16:24:53 +01:00
tg-service-proxy-expose.hcl hclv1: tweak HCLv1 tests 2020-10-21 14:05:46 -04:00
vault_inheritance.hcl chore: initial hclfmt 2019-10-11 14:00:05 +02:00
version-constraint.hcl chore: initial hclfmt 2019-10-11 14:00:05 +02:00