fetchSecondFetchFails,
}
+ for _, f := range tests {
+ runMainTest(t, f)
+ }
+}
+
+func runMainTest(t *testing.T, f func(args)) {
cleanup := []string{
configPath,
statePath,
groupPath,
}
- for _, f := range tests {
// NOTE: This is not guaranteed to work according to reflect's
// documentation but seems to work reliable for normal
// functions.
}
var handler func(http.ResponseWriter, *http.Request)
- ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
- handler(w, r)
- }))
+ ts := httptest.NewServer(http.HandlerFunc(
+ func(w http.ResponseWriter, r *http.Request) {
+ handler(w, r)
+ }))
defer ts.Close()
f(args{
handler: &handler,
})
})
- }
}
func fetchPasswdCacheFileDoesNotExist(a args) {
"status code 404")
mustNotExist(t, statePath, plainPath)
- // Even tough passwd was successfully fetched, no files were modified
+ // Even though passwd was successfully fetched, no files were modified
// because the second fetch failed
mustBeOld(t, passwdPath, groupPath)
}