MCPcopy
hub / github.com/cloudflare/cloudflared / TestDeprecatedFeaturesRemoved

Function TestDeprecatedFeaturesRemoved

features/selector_test.go:133–170  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

131}
132
133func TestDeprecatedFeaturesRemoved(t *testing.T) {
134 logger := zerolog.Nop()
135 tests := []struct {
136 name string
137 cli []string
138 remote featuresRecord
139 expectedFeatures []string
140 }{
141 {
142 name: "no_removals",
143 cli: []string{},
144 remote: featuresRecord{},
145 expectedFeatures: defaultFeatures,
146 },
147 {
148 name: "support_datagram_v3",
149 cli: []string{DeprecatedFeatureDatagramV3},
150 remote: featuresRecord{},
151 expectedFeatures: defaultFeatures,
152 },
153 {
154 name: "support_datagram_v3_1",
155 cli: []string{DeprecatedFeatureDatagramV3_1},
156 remote: featuresRecord{},
157 expectedFeatures: defaultFeatures,
158 },
159 }
160
161 for _, test := range tests {
162 t.Run(test.name, func(t *testing.T) {
163 resolver := &staticResolver{record: test.remote}
164 selector, err := newFeatureSelector(t.Context(), test.name, &logger, resolver, test.cli, false, time.Second)
165 require.NoError(t, err)
166 snapshot := selector.Snapshot()
167 require.ElementsMatch(t, test.expectedFeatures, snapshot.FeaturesList)
168 })
169 }
170}
171
172func TestRefreshFeaturesRecord(t *testing.T) {
173 percentages := []uint32{0, 10, testAccountHash - 1, testAccountHash, testAccountHash + 1, 100, 101, 1000}

Callers

nothing calls this directly

Calls 4

newFeatureSelectorFunction · 0.85
RunMethod · 0.65
ContextMethod · 0.65
SnapshotMethod · 0.65

Tested by

no test coverage detected