Exemplo n.º 1
0
func TestErrorOnNonExistantKey(t *testing.T) {
	setupConsul(t)
	_, err := configurator.GetString("NonExistantKey")

	if err == nil {
		t.Error("Should have failed on getting a non-existant key")
	}

}
Exemplo n.º 2
0
func TestGettingExpectedKeyWithStringValue(t *testing.T) {
	setupConsul(t)

	actualValue, err := configurator.GetString(expectedKeyWithStringValue)

	if err != nil {
		t.Error("accessing configuration value has failed")
	}
	if actualValue != expectedConfiguration[expectedKeyWithStringValue] {
		t.Errorf("wrong value was retrieved, %s should be %s", actualValue, expectedConfiguration[expectedKeyWithStringValue])
	}
}