Esempio n. 1
0
func TestConfigSyncInitialMap(t *testing.T) {
	// start with different initial map
	kd := newKubeDNS()
	mockSync := config.NewMockSync(
		&config.Config{Federations: map[string]string{"name3": "domain3"}}, nil)
	kd.configSync = mockSync

	kd.startConfigMapSync()
	checkConfigEqual(t, kd, &config.Config{Federations: map[string]string{"name3": "domain3"}})
}
Esempio n. 2
0
func TestConfigSync(t *testing.T) {
	kd := newKubeDNS()
	mockSync := config.NewMockSync(
		&config.Config{Federations: make(map[string]string)}, nil)
	kd.configSync = mockSync

	kd.startConfigMapSync()

	checkConfigEqual(t, kd, &config.Config{Federations: make(map[string]string)})
	// update
	mockSync.Chan <- &config.Config{Federations: map[string]string{"name1": "domain1"}}
	checkConfigEqual(t, kd, &config.Config{Federations: map[string]string{"name1": "domain1"}})
	// update
	mockSync.Chan <- &config.Config{Federations: map[string]string{"name2": "domain2"}}
	checkConfigEqual(t, kd, &config.Config{Federations: map[string]string{"name2": "domain2"}})
}