func TestPostgresqlSampleConfig(t *testing.T) {
	p1 := newPostgresql()
	require.NoError(t, p1.Init())

	p2 := newPostgresql()
	re := regexp.MustCompile(`(?m)^\s*#`)
	conf := re.ReplaceAllLiteralString(p1.SampleConfig(), "")
	require.NoError(t, toml.Unmarshal([]byte(conf), p2))
	require.NoError(t, p2.Init())

	// Can't use assert.Equal() because it dives into unexported fields that contain unequal values.
	// Serializing to JSON is effective as any differences will be visible in exported fields.
	p1json, _ := json.Marshal(p1)
	p2json, _ := json.Marshal(p2)
	assert.JSONEq(t, string(p1json), string(p2json), "Sample config does not match default config")
}
// Verify that the documented defaults match the actual defaults.
//
// Sample config must be in the format documented in `docs/developers/SAMPLE_CONFIG.md`.
Verify that the documented defaults match the actual defaults.

Sample config must be in the format documented in `docs/developers/SAMPLE_CONFIG.md`.
// Verify that the documented defaults match the actual defaults . // // Sample config must be in the format documented in ` docs / developers / SAMPLE_CONFIG . md ` .
func TestPostgresqlSampleConfig(t *testing.T) {
	p1 := newPostgresql()
	require.NoError(t, p1.Init())
	p2 := newPostgresql()
	re := regexp.MustCompile(`(?m)^\s*#`)
	conf := re.ReplaceAllLiteralString(p1.SampleConfig(), "")
	require.NoError(t, toml.Unmarshal([]byte(conf), p2))
	require.NoError(t, p2.Init())
	p1json, _ := json.Marshal(p1)
	p2json, _ := json.Marshal(p2)
	assert.JSONEq(t, string(p1json), string(p2json), "Sample config does not match default config")
}
func TestPostgresqlSampleConfig ( t * testing . T ) { p1 := newPostgresql ( ) require . NoError ( t , p1 . Init ( ) ) p2 := newPostgresql ( ) re := regexp . MustCompile ( `(?m)^\s*#` ) conf := re . ReplaceAllLiteralString ( p1 . SampleConfig ( ) , " " ) require . NoError ( t , toml . Unmarshal ( [ ] byte ( conf ) , p2 ) ) require . NoError ( t , p2 . Init ( ) ) p1json , _ := json . Marshal ( p1 ) p2json , _ := json . Marshal ( p2 ) assert . JSONEq ( t , string ( p1json ) , string ( p2json ) , " " ) }
Verify that the documented defaults match the actual defaults.
Verify that the documented defaults match the actual defaults .
// Can't use assert.Equal() because it dives into unexported fields that contain unequal values. // Serializing to JSON is effective as any differences will be visible in exported fields.