mirror of
				https://github.com/optim-enterprises-bv/vault.git
				synced 2025-11-03 03:58:01 +00:00 
			
		
		
		
	command/server: fix TestLoadConfigFile_json2 test, fix hcl tags (#7300)
* command/server: fix TestLoadConfigFile_json2 test, fix hcl tags Fixes test to call the equality check, and add missing values to the expected object. Fixes hcl tags in the Telemetry structs. * fix PrometheusRetentionTime tag
This commit is contained in:
		
				
					committed by
					
						
						Jeff Mitchell
					
				
			
			
				
	
			
			
			
						parent
						
							28e8973073
						
					
				
				
					commit
					d0d17ed40e
				
			@@ -208,10 +208,10 @@ type Telemetry struct {
 | 
				
			|||||||
	// CirconusCheckTags is a comma separated list of tags to apply to the check. Note that
 | 
						// CirconusCheckTags is a comma separated list of tags to apply to the check. Note that
 | 
				
			||||||
	// the value of CirconusCheckSearchTag will always be added to the check.
 | 
						// the value of CirconusCheckSearchTag will always be added to the check.
 | 
				
			||||||
	// Default: none
 | 
						// Default: none
 | 
				
			||||||
	CirconusCheckTags string `mapstructure:"circonus_check_tags"`
 | 
						CirconusCheckTags string `hcl:"circonus_check_tags"`
 | 
				
			||||||
	// CirconusCheckDisplayName is the name for the check which will be displayed in the Circonus UI.
 | 
						// CirconusCheckDisplayName is the name for the check which will be displayed in the Circonus UI.
 | 
				
			||||||
	// Default: value of CirconusCheckInstanceID
 | 
						// Default: value of CirconusCheckInstanceID
 | 
				
			||||||
	CirconusCheckDisplayName string `mapstructure:"circonus_check_display_name"`
 | 
						CirconusCheckDisplayName string `hcl:"circonus_check_display_name"`
 | 
				
			||||||
	// CirconusBrokerID is an explicit broker to use when creating a new check. The numeric portion
 | 
						// CirconusBrokerID is an explicit broker to use when creating a new check. The numeric portion
 | 
				
			||||||
	// of broker._cid. If metric management is enabled and neither a Submission URL nor Check ID
 | 
						// of broker._cid. If metric management is enabled and neither a Submission URL nor Check ID
 | 
				
			||||||
	// is provided, an attempt will be made to search for an existing check using Instance ID and
 | 
						// is provided, an attempt will be made to search for an existing check using Instance ID and
 | 
				
			||||||
@@ -239,7 +239,7 @@ type Telemetry struct {
 | 
				
			|||||||
	// Prometheus:
 | 
						// Prometheus:
 | 
				
			||||||
	// PrometheusRetentionTime is the retention time for prometheus metrics if greater than 0.
 | 
						// PrometheusRetentionTime is the retention time for prometheus metrics if greater than 0.
 | 
				
			||||||
	// Default: 24h
 | 
						// Default: 24h
 | 
				
			||||||
	PrometheusRetentionTime    time.Duration `hcl:-`
 | 
						PrometheusRetentionTime    time.Duration `hcl:"-"`
 | 
				
			||||||
	PrometheusRetentionTimeRaw interface{}   `hcl:"prometheus_retention_time"`
 | 
						PrometheusRetentionTimeRaw interface{}   `hcl:"prometheus_retention_time"`
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -247,7 +247,6 @@ func TestLoadConfigFile_json2(t *testing.T) {
 | 
				
			|||||||
			Config: map[string]string{
 | 
								Config: map[string]string{
 | 
				
			||||||
				"foo": "bar",
 | 
									"foo": "bar",
 | 
				
			||||||
			},
 | 
								},
 | 
				
			||||||
			DisableClustering: true,
 | 
					 | 
				
			||||||
		},
 | 
							},
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		HAStorage: &Storage{
 | 
							HAStorage: &Storage{
 | 
				
			||||||
@@ -255,15 +254,19 @@ func TestLoadConfigFile_json2(t *testing.T) {
 | 
				
			|||||||
			Config: map[string]string{
 | 
								Config: map[string]string{
 | 
				
			||||||
				"bar": "baz",
 | 
									"bar": "baz",
 | 
				
			||||||
			},
 | 
								},
 | 
				
			||||||
 | 
								DisableClustering: true,
 | 
				
			||||||
		},
 | 
							},
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		CacheSize: 45678,
 | 
							CacheSize: 45678,
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		EnableUI: true,
 | 
							EnableUI:    true,
 | 
				
			||||||
 | 
							EnableUIRaw: true,
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		EnableRawEndpoint: true,
 | 
							EnableRawEndpoint:    true,
 | 
				
			||||||
 | 
							EnableRawEndpointRaw: true,
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		DisableSealWrap: true,
 | 
							DisableSealWrap:    true,
 | 
				
			||||||
 | 
							DisableSealWrapRaw: true,
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		Telemetry: &Telemetry{
 | 
							Telemetry: &Telemetry{
 | 
				
			||||||
			StatsiteAddr:                       "foo",
 | 
								StatsiteAddr:                       "foo",
 | 
				
			||||||
@@ -287,6 +290,7 @@ func TestLoadConfigFile_json2(t *testing.T) {
 | 
				
			|||||||
		},
 | 
							},
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	if !reflect.DeepEqual(config, expected) {
 | 
						if !reflect.DeepEqual(config, expected) {
 | 
				
			||||||
 | 
							t.Fatalf("expected \n\n%#v\n\n to be \n\n%#v\n\n", config, expected)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user