MCPcopy
hub / github.com/tailscale/tailscale / test

Function test

cmd/gitops-pusher/gitops-pusher.go:105–146  ·  view source on GitHub ↗
(cache *Cache, tailnet string)

Source from the content-addressed store, hash-verified

103}
104
105func test(cache *Cache, tailnet string) func(context.Context, []string) error {
106 return func(ctx context.Context, args []string) error {
107 controlEtag, err := getACLETag(ctx, tailnet)
108 if err != nil {
109 return err
110 }
111
112 localEtag, err := sumFile(*policyFname)
113 if err != nil {
114 return err
115 }
116
117 if cache.PrevETag == "" {
118 log.Println("no previous etag found, assuming the latest control etag")
119 cache.PrevETag = controlEtag
120 }
121
122 log.Printf("control: %s", controlEtag)
123 log.Printf("local: %s", localEtag)
124 log.Printf("cache: %s", cache.PrevETag)
125
126 if controlEtag == localEtag {
127 log.Println("no updates found, doing nothing")
128 return nil
129 }
130
131 if cache.PrevETag != controlEtag {
132 if err := modifiedExternallyError(); err != nil {
133 if *failOnManualEdits {
134 return err
135 } else {
136 fmt.Println(err)
137 }
138 }
139 }
140
141 if err := testNewACLs(ctx, tailnet, *policyFname); err != nil {
142 return err
143 }
144 return nil
145 }
146}
147
148func getChecksums(cache *Cache, tailnet string) func(context.Context, []string) error {
149 return func(ctx context.Context, args []string) error {

Callers 2

mainFunction · 0.70
TestContainerBootFunction · 0.50

Calls 5

getACLETagFunction · 0.85
sumFileFunction · 0.85
modifiedExternallyErrorFunction · 0.85
testNewACLsFunction · 0.85
PrintfMethod · 0.80

Tested by 1

TestContainerBootFunction · 0.40

Used in the wild real call sites across dependent graphs

searching dependent graphs…