Fix TestJobCaching. Swap WriteFile and second Client.Build

This commit is contained in:
Николай Луцяк 2020-04-27 18:34:19 +00:00 committed by Fedor Korotkiy
parent f00962e44d
commit 7cca06a1a3

View file

@ -62,11 +62,11 @@ func TestJobCaching(t *testing.T) {
assert.Len(t, recorder.Jobs, 1) assert.Len(t, recorder.Jobs, 1)
assert.Equal(t, &JobResult{Stdout: "OK\n", Code: new(int)}, recorder.Jobs[build.ID{'a'}]) assert.Equal(t, &JobResult{Stdout: "OK\n", Code: new(int)}, recorder.Jobs[build.ID{'a'}])
require.NoError(t, ioutil.WriteFile(tmpFile.Name(), []byte("NOTOK\n"), 0666))
// Second build must get results from cache. // Second build must get results from cache.
require.NoError(t, env.Client.Build(env.Ctx, graph, NewRecorder())) require.NoError(t, env.Client.Build(env.Ctx, graph, NewRecorder()))
require.NoError(t, ioutil.WriteFile(tmpFile.Name(), []byte("NOTOK\n"), 0666))
output, err := ioutil.ReadAll(tmpFile) output, err := ioutil.ReadAll(tmpFile)
require.NoError(t, err) require.NoError(t, err)
require.Equal(t, []byte("NOTOK\n"), output) require.Equal(t, []byte("NOTOK\n"), output)