Fixed Meta name for JSON + Added unit tests for HCL/JSON

This commit is contained in:
Pierre Souchay 2018-04-24 16:39:43 +02:00
parent c152cb7bdf
commit eccc223480
2 changed files with 8 additions and 1 deletions

View File

@ -319,7 +319,7 @@ type ServiceDefinition struct {
Name *string `json:"name,omitempty" hcl:"name" mapstructure:"name"` Name *string `json:"name,omitempty" hcl:"name" mapstructure:"name"`
Tags []string `json:"tags,omitempty" hcl:"tags" mapstructure:"tags"` Tags []string `json:"tags,omitempty" hcl:"tags" mapstructure:"tags"`
Address *string `json:"address,omitempty" hcl:"address" mapstructure:"address"` Address *string `json:"address,omitempty" hcl:"address" mapstructure:"address"`
Meta map[string]string `json:"node_meta,omitempty" hcl:"meta" mapstructure:"meta"` Meta map[string]string `json:"meta,omitempty" hcl:"meta" mapstructure:"meta"`
Port *int `json:"port,omitempty" hcl:"port" mapstructure:"port"` Port *int `json:"port,omitempty" hcl:"port" mapstructure:"port"`
Check *CheckDefinition `json:"check,omitempty" hcl:"check" mapstructure:"check"` Check *CheckDefinition `json:"check,omitempty" hcl:"check" mapstructure:"check"`
Checks []CheckDefinition `json:"checks,omitempty" hcl:"checks" mapstructure:"checks"` Checks []CheckDefinition `json:"checks,omitempty" hcl:"checks" mapstructure:"checks"`

View File

@ -2438,6 +2438,9 @@ func TestFullConfig(t *testing.T) {
"service": { "service": {
"id": "dLOXpSCI", "id": "dLOXpSCI",
"name": "o1ynPkp0", "name": "o1ynPkp0",
"meta": {
"mymeta": "data"
},
"tags": ["nkwshvM5", "NTDWn3ek"], "tags": ["nkwshvM5", "NTDWn3ek"],
"address": "cOlSOhbp", "address": "cOlSOhbp",
"token": "msy7iWER", "token": "msy7iWER",
@ -2875,6 +2878,9 @@ func TestFullConfig(t *testing.T) {
service = { service = {
id = "dLOXpSCI" id = "dLOXpSCI"
name = "o1ynPkp0" name = "o1ynPkp0"
meta = {
mymeta = "data"
}
tags = ["nkwshvM5", "NTDWn3ek"] tags = ["nkwshvM5", "NTDWn3ek"]
address = "cOlSOhbp" address = "cOlSOhbp"
token = "msy7iWER" token = "msy7iWER"
@ -3528,6 +3534,7 @@ func TestFullConfig(t *testing.T) {
Tags: []string{"nkwshvM5", "NTDWn3ek"}, Tags: []string{"nkwshvM5", "NTDWn3ek"},
Address: "cOlSOhbp", Address: "cOlSOhbp",
Token: "msy7iWER", Token: "msy7iWER",
Meta: map[string]string{"mymeta": "data"},
Port: 24237, Port: 24237,
EnableTagOverride: true, EnableTagOverride: true,
Checks: structs.CheckTypes{ Checks: structs.CheckTypes{