github.com/qiniu/go-sdk/v7@v7.27.0/storage/pfop_test.go (about) 1 //go:build integration 2 // +build integration 3 4 package storage 5 6 import ( 7 "encoding/base64" 8 "fmt" 9 "strings" 10 "testing" 11 ) 12 13 var testVideoKey = "qiniu.mp4" 14 15 func TestPfop(t *testing.T) { 16 saveBucket := testBucket 17 18 fopAvthumb := fmt.Sprintf("avthumb/mp4/s/480x320/vb/500k|saveas/%s", 19 EncodedEntry(saveBucket, "pfop_test_qiniu.mp4")) 20 fopVframe := fmt.Sprintf("vframe/jpg/offset/10|saveas/%s", 21 EncodedEntry(saveBucket, "pfop_test_qiniu.jpg")) 22 fopVsample := fmt.Sprintf("vsample/jpg/interval/20/pattern/%s", 23 base64.URLEncoding.EncodeToString([]byte("pfop_test_$(count).jpg"))) 24 25 fopBatch := []string{fopAvthumb, fopVframe, fopVsample} 26 fops := strings.Join(fopBatch, ";") 27 28 force := true 29 notifyURL := "" 30 pid, err := operationManager.Pfop(testBucket, testVideoKey, fops, 31 testPipeline, notifyURL, force) 32 if err != nil { 33 t.Fatalf("Pfop() error, %s", err) 34 } 35 t.Logf("persistentId: %s", pid) 36 37 prefopRet, err := operationManager.Prefop(pid) 38 if err != nil { 39 t.Fatalf("Prefop() error, %s", err) 40 } 41 t.Logf("%s", prefopRet.String()) 42 }