INNER CODE UNIT · Go

TestServiceEnvConfigStruct

rameshsunkara/go-rest-api-example · internal/config/config_test.go:68

func TestServiceEnvConfigStruct(t *testing.T) {
	// Test that we can create the struct
	cfg := &config.ServiceEnvConfig{
		Environment:          "test",
		Port:                 "8080",
		LogLevel:             "debug",
		DBHosts:              "localhost:27017",
		DBName:               "testdb",
		DBCredentialsSideCar: "/test/path",
		DBLogQueries:         true,
		DisableAuth:          false,
		EnableTracing:        true,
	}

	assert.Equal(t, "test", cfg.Environment)
	assert.Equal(t, "8080", cfg.Port)
	assert.Equal(t, "debug", cfg.LogLevel)
	assert.Equal(t, "localhost:27017", cfg.DBHosts)

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…