lib: Apply config changes sequentially (ref #5298) (#7188)

This commit is contained in:
Simon Frei
2021-01-15 15:43:34 +01:00
committed by GitHub
parent b2d82da20d
commit f63cdbfcfa
20 changed files with 1032 additions and 790 deletions
+17 -7
View File
@@ -60,11 +60,16 @@ func TestProgressEmitter(t *testing.T) {
w := evLogger.Subscribe(events.DownloadProgress)
c := createTmpWrapper(config.Configuration{})
c, cfgCancel := createTmpWrapper(config.Configuration{})
defer os.Remove(c.ConfigPath())
c.SetOptions(config.OptionsConfiguration{
ProgressUpdateIntervalS: 60, // irrelevant, but must be positive
defer cfgCancel()
waiter, err := c.Modify(func(cfg *config.Configuration) {
cfg.Options.ProgressUpdateIntervalS = 60 // irrelevant, but must be positive
})
if err != nil {
t.Fatal(err)
}
waiter.Wait()
p := NewProgressEmitter(c, evLogger)
go p.Serve(ctx)
@@ -109,12 +114,17 @@ func TestProgressEmitter(t *testing.T) {
}
func TestSendDownloadProgressMessages(t *testing.T) {
c := createTmpWrapper(config.Configuration{})
c, cfgCancel := createTmpWrapper(config.Configuration{})
defer os.Remove(c.ConfigPath())
c.SetOptions(config.OptionsConfiguration{
ProgressUpdateIntervalS: 60, // irrelevant, but must be positive
TempIndexMinBlocks: 10,
defer cfgCancel()
waiter, err := c.Modify(func(cfg *config.Configuration) {
cfg.Options.ProgressUpdateIntervalS = 60 // irrelevant, but must be positive
cfg.Options.TempIndexMinBlocks = 10
})
if err != nil {
t.Fatal(err)
}
waiter.Wait()
fc := &fakeConnection{}