MCPcopy
hub / github.com/rclone/rclone / TestTouchWithMetadata

Function TestTouchWithMetadata

cmd/touch/touch_test.go:154–181  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

152}
153
154func TestTouchWithMetadata(t *testing.T) {
155 r := fstest.NewRun(t)
156 ctx := context.Background()
157 features := r.Fremote.Features()
158 if !features.UserMetadata {
159 t.Skip("Skipping metadata test; backend does not support user metadata")
160 }
161
162 ci := fs.GetConfig(ctx)
163 origMetadata := ci.Metadata
164 origMetadataSet := ci.MetadataSet
165 t.Cleanup(func() {
166 ci.Metadata = origMetadata
167 ci.MetadataSet = origMetadataSet
168 })
169
170 ci.Metadata = true
171 ci.MetadataSet = fs.Metadata{
172 "testkey": "testvalue",
173 }
174
175 err := Touch(ctx, r.Fremote, "metaFile")
176 require.NoError(t, err)
177
178 o, err := r.Fremote.NewObject(ctx, "metaFile")
179 require.NoError(t, err)
180 fstest.CheckEntryMetadata(ctx, t, r.Fremote, o, ci.MetadataSet)
181}

Callers

nothing calls this directly

Calls 6

NewRunFunction · 0.92
GetConfigFunction · 0.92
CheckEntryMetadataFunction · 0.92
TouchFunction · 0.85
FeaturesMethod · 0.65
NewObjectMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…