test/e2e/certrefresh: Add file.Sync() to eliminate slow write failures. (#5033)

This commit eliminates the potential for a slow disk write to cause a test failure in the certificate rotation tests by adding a file `Sync()` call in the function used to copy certificate files around.

Signed-off-by: Philip Conrad <philipaconrad@gmail.com>
This commit is contained in:
Philip Conrad
2022-08-22 14:14:04 -04:00
committed by GitHub
parent f6d1c1b802
commit ec0079c784
+6 -1
View File
@@ -155,7 +155,12 @@ func copy(from, to string) error {
defer dst.Close()
_, err = io.Copy(dst, src)
return err
if err != nil {
return err
}
// Ensure that our writes get committed to disk, even on slower systems.
return dst.Sync()
}
func getCert(t *testing.T) *x509.Certificate {