mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-16 15:20:17 +00:00
Merge pull request #123856 from aramase/aramase/t/reload_int_test_fix
fix test flake in TestStructuredAuthenticationConfigReload
This commit is contained in:
commit
05ccec23aa
@ -1332,7 +1332,19 @@ jwt:
|
|||||||
_, err = client.CoreV1().Pods(defaultNamespace).List(ctx, metav1.ListOptions{})
|
_, err = client.CoreV1().Pods(defaultNamespace).List(ctx, metav1.ListOptions{})
|
||||||
tt.assertErrFn(t, err)
|
tt.assertErrFn(t, err)
|
||||||
|
|
||||||
err = os.WriteFile(apiServer.ServerOpts.Authentication.AuthenticationConfigFile, []byte(tt.newAuthConfigFn(t, oidcServer.URL(), string(caCert))), 0600)
|
// Create a temporary file
|
||||||
|
tempFile, err := os.CreateTemp("", "tempfile")
|
||||||
|
require.NoError(t, err)
|
||||||
|
defer func() {
|
||||||
|
_ = tempFile.Close()
|
||||||
|
}()
|
||||||
|
|
||||||
|
// Write the new content to the temporary file
|
||||||
|
_, err = tempFile.Write([]byte(tt.newAuthConfigFn(t, oidcServer.URL(), string(caCert))))
|
||||||
|
require.NoError(t, err)
|
||||||
|
|
||||||
|
// Atomically replace the original file with the temporary file
|
||||||
|
err = os.Rename(tempFile.Name(), apiServer.ServerOpts.Authentication.AuthenticationConfigFile)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
if tt.waitAfterConfigSwap {
|
if tt.waitAfterConfigSwap {
|
||||||
|
Loading…
Reference in New Issue
Block a user