Skip to content

Commit

Permalink
no longer trusting IO in CI
Browse files Browse the repository at this point in the history
Signed-off-by: Andrew Mason <[email protected]>
  • Loading branch information
Andrew Mason committed Jun 20, 2023
1 parent 1b412e8 commit 33d991d
Showing 1 changed file with 21 additions and 2 deletions.
23 changes: 21 additions & 2 deletions go/viperutil/internal/sync/sync_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ import (
)

func TestPersistConfig(t *testing.T) {
t.Skip("temporarily skipping this to unblock PRs since it's flaky")
// t.Skip("temporarily skipping this to unblock PRs since it's flaky")
type config struct {
Foo int `json:"foo"`
}
Expand Down Expand Up @@ -156,7 +156,26 @@ func TestWatchConfig(t *testing.T) {
return err
}

return os.WriteFile(tmp.Name(), data, stat.Mode())
err = os.WriteFile(tmp.Name(), data, stat.Mode())
if err != nil {
return err
}

data, err = os.ReadFile(tmp.Name())
if err != nil {
return err
}

var cfg config
if err := json.Unmarshal(data, &cfg); err != nil {
return err
}

if cfg.A != a || cfg.B != b {
return fmt.Errorf("config did not persist; want %+v got %+v", config{A: a, B: b}, cfg)
}

return nil
}
writeRandomConfig := func() error {
a, b := rand.Intn(100), rand.Intn(100)
Expand Down

0 comments on commit 33d991d

Please sign in to comment.