Skip to content

Commit 7d346bb

Browse files
committed
fix TestKeystoreRemoveMultipleExistingKeys
1 parent 462b708 commit 7d346bb

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

libbeat/tests/integration/cmd_keystore_test.go

+7-3
Original file line numberDiff line numberDiff line change
@@ -100,19 +100,23 @@ func TestKeystoreRemoveMultipleExistingKeys(t *testing.T) {
100100
mockbeat.Stop()
101101

102102
mockbeat.Start("keystore", "add", "key1", "--stdin")
103-
fmt.Fprintf(os.Stdin, "pass1")
103+
104+
fmt.Fprintf(mockbeat.stdin, "pass1")
105+
require.NoError(t, mockbeat.stdin.Close(), "could not close mockbeat stdin")
104106
procState, err := mockbeat.Process.Wait()
105107
require.NoError(t, err)
106108
require.Equal(t, 0, procState.ExitCode(), "incorrect exit code")
107109

108110
mockbeat.Start("keystore", "add", "key2", "--stdin")
109-
fmt.Fprintf(os.Stdin, "pass2")
111+
fmt.Fprintf(mockbeat.stdin, "pass2")
112+
require.NoError(t, mockbeat.stdin.Close(), "could not close mockbeat stdin")
110113
procState, err = mockbeat.Process.Wait()
111114
require.NoError(t, err)
112115
require.Equal(t, 0, procState.ExitCode(), "incorrect exit code")
113116

114117
mockbeat.Start("keystore", "add", "key3", "--stdin")
115-
fmt.Fprintf(os.Stdin, "pass3")
118+
fmt.Fprintf(mockbeat.stdin, "pass3")
119+
require.NoError(t, mockbeat.stdin.Close(), "could not close mockbeat stdin")
116120
procState, err = mockbeat.Process.Wait()
117121
require.NoError(t, err)
118122
require.Equal(t, 0, procState.ExitCode(), "incorrect exit code")

0 commit comments

Comments
 (0)