cloudflare/cloudflared

Public

mirrored from https://github.com/cloudflare/cloudflaredAvailable

CodeCommitsIssuesPull requestsActionsInsightsSecurity
2019.11.2

Branches

Tags

  • No tags available.
0Branches0Tags
Go to file
Add file
Code

Clone

HTTPS

Download ZIP

cmd/cloudflared/updater/update_test.go

26lines · modecode

1package updater
2
3import (
4 "context"
5 "testing"
6
7 "github.com/facebookgo/grace/gracenet"
8 "github.com/stretchr/testify/assert"
9)
10
11func TestDisabledAutoUpdater(t *testing.T) {
12 listeners := &gracenet.Net{}
13 autoupdater := NewAutoUpdater(0, listeners)
14 ctx, cancel := context.WithCancel(context.Background())
15 errC := make(chan error)
16 go func() {
17 errC <- autoupdater.Run(ctx)
18 }()
19
20 assert.False(t, autoupdater.configurable.enabled)
21 assert.Equal(t, DefaultCheckUpdateFreq, autoupdater.configurable.freq)
22
23 cancel()
24 // Make sure that autoupdater terminates after canceling the context
25 assert.Equal(t, context.Canceled, <-errC)
26}
27