Esempio n. 1
0
// test scribble cache listRecords
func TestScribbleListRecords(t *testing.T) {
	scribbleReset()
	_, err := cache.ListRecords()
	cache.ResetRecords(&nanoBoth)
	_, err2 := cache.ListRecords()
	if err != nil || err2 != nil {
		t.Errorf("Failed to list records in scribble cacher - %v%v", err, err2)
	}
}
Esempio n. 2
0
// test nil cache listRecords
func TestNoneListRecords(t *testing.T) {
	noneReset()
	_, err := cache.ListRecords()
	if err != nil {
		t.Errorf("Failed to list records in none cacher - %v", err)
	}
}
Esempio n. 3
0
// ListRecords returns all known domains
func ListRecords() []sham.Resource {
	if cache.Exists() {
		// get from cache
		stored, _ := cache.ListRecords()
		if len(Answers) != len(stored) {
			config.Log.Debug("Cache differs from local, updating...")
			ResetRecords(&stored, true)
		}
	}

	resources := make([]sham.Resource, 0)
	for _, v := range Answers {
		resources = append(resources, v)
	}

	return resources
}