()
| 42 | } |
| 43 | |
| 44 | func initConfig() (config.Wrapper, context.CancelFunc) { |
| 45 | wrapper := config.Wrap("/dev/null", config.New(device1), device1, events.NoopLogger) |
| 46 | dev1Conf = newDeviceConfiguration(wrapper, device1, "device1") |
| 47 | dev2Conf = newDeviceConfiguration(wrapper, device2, "device2") |
| 48 | dev3Conf = newDeviceConfiguration(wrapper, device3, "device3") |
| 49 | dev4Conf = newDeviceConfiguration(wrapper, device4, "device4") |
| 50 | |
| 51 | ctx, cancel := context.WithCancel(context.Background()) |
| 52 | go wrapper.Serve(ctx) |
| 53 | |
| 54 | dev2Conf.MaxRecvKbps = rand.Int() % 100000 |
| 55 | dev2Conf.MaxSendKbps = rand.Int() % 100000 |
| 56 | |
| 57 | waiter, _ := wrapper.Modify(func(cfg *config.Configuration) { |
| 58 | cfg.SetDevices([]config.DeviceConfiguration{dev1Conf, dev2Conf, dev3Conf, dev4Conf}) |
| 59 | }) |
| 60 | waiter.Wait() |
| 61 | return wrapper, cancel |
| 62 | } |
| 63 | |
| 64 | func TestLimiterInit(t *testing.T) { |
| 65 | wrapper, wrapperCancel := initConfig() |
no test coverage detected