text
stringlengths
93
16.4k
id
stringlengths
20
40
metadata
dict
input_ids
listlengths
45
2.05k
attention_mask
listlengths
45
2.05k
complexity
int64
1
9
func TestCSV_EmptyFile(t *testing.T) { newCSV, err := CreateCSV("../_csv_tests/test003.csv", ' ', testCsvNode{}) if err != nil { t.Error(err) return } for i := 0; i < 2000; i++ { newCSV.Append(testCsvNode{ Name: fmt.Sprintf("name:%d", i), LastName: fmt.Sprintf("temp:%d", i+1000), Data: 1.2222 + float32(i), Value: i * 2000, }) } newCSV.SaveAll() newCSV.CloseAll() }
explode_data.jsonl/10623
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 202 }
[ 2830, 3393, 44209, 76060, 1595, 1703, 1155, 353, 8840, 836, 8, 341, 8638, 44209, 11, 1848, 1669, 4230, 44209, 17409, 62, 18104, 32509, 12697, 15, 15, 18, 11219, 497, 364, 197, 516, 1273, 94826, 1955, 37790, 743, 1848, 961, 2092, 341, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestPodIsNotDeletedByDaemonsetWithEmptyLabelSelector(t *testing.T) { // Create a misconfigured DaemonSet. An empty pod selector is invalid but could happen // if we upgrade and make a backwards incompatible change. // // The node selector matches no nodes which mimics the behavior of kubectl delete. // // The DaemonSet should not schedule pods and should not delete scheduled pods in // this case even though it's empty pod selector matches all pods. The DaemonSetController // should detect this misconfiguration and choose not to sync the DaemonSet. We should // not observe a deletion of the pod on node1. for _, strategy := range updateStrategies() { ds := newDaemonSet("foo") ds.Spec.UpdateStrategy = *strategy ls := metav1.LabelSelector{} ds.Spec.Selector = &ls ds.Spec.Template.Spec.NodeSelector = map[string]string{"foo": "bar"} manager, podControl, _, err := newTestController(ds) if err != nil { t.Fatalf("error creating DaemonSets controller: %v", err) } manager.nodeStore.Add(newNode("node1", nil)) // Create pod not controlled by a daemonset. manager.podStore.Add(&v1.Pod{ ObjectMeta: metav1.ObjectMeta{ Labels: map[string]string{"bang": "boom"}, Namespace: metav1.NamespaceDefault, }, Spec: v1.PodSpec{ NodeName: "node1", }, }) manager.dsStore.Add(ds) syncAndValidateDaemonSets(t, manager, ds, podControl, 0, 0, 1) } }
explode_data.jsonl/50321
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 488 }
[ 2830, 3393, 23527, 3872, 2623, 26039, 1359, 89177, 746, 2354, 3522, 2476, 5877, 1155, 353, 8840, 836, 8, 341, 197, 322, 4230, 264, 5786, 81443, 92236, 1649, 13, 1527, 4287, 7509, 9367, 374, 8318, 714, 1410, 3537, 198, 197, 322, 421, 5...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestGetEnabledExchanges(t *testing.T) { cfg := GetConfig() err := cfg.LoadConfig(ConfigTestFile) if err != nil { t.Errorf( "Test failed. TestGetEnabledExchanges. LoadConfig Error: %s", err.Error(), ) } exchanges := cfg.GetEnabledExchanges() if len(exchanges) != 26 { t.Error( "Test failed. TestGetEnabledExchanges. Enabled exchanges value mismatch", ) } if !common.StringDataCompare(exchanges, "Bitfinex") { t.Error( "Test failed. TestGetEnabledExchanges. Expected exchange Bitfinex not found", ) } }
explode_data.jsonl/21891
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 197 }
[ 2830, 3393, 1949, 5462, 840, 19365, 1155, 353, 8840, 836, 8, 341, 50286, 1669, 2126, 2648, 741, 9859, 1669, 13286, 13969, 2648, 33687, 2271, 1703, 340, 743, 1848, 961, 2092, 341, 197, 3244, 13080, 1006, 298, 197, 1, 2271, 4641, 13, 33...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
4
func TestExtensionAPIServerConfigMap(t *testing.T) { masterConfig, clusterAdminKubeConfig, err := testserver.StartTestMaster() if err != nil { t.Fatalf("unexpected error: %v", err) } defer testserver.CleanupMasterEtcd(t, masterConfig) clusterAdminKubeClient, err := testutil.GetClusterAdminKubeClient(clusterAdminKubeConfig) if err != nil { t.Fatalf("unexpected error: %v", err) } var configmap *kapi.ConfigMap err = utilwait.PollImmediate(50*time.Millisecond, 10*time.Second, func() (bool, error) { configmap, err = clusterAdminKubeClient.Core().ConfigMaps(metav1.NamespaceSystem).Get("extension-apiserver-authentication", metav1.GetOptions{}) if err == nil { return true, nil } if kapierrors.IsNotFound(err) { return false, nil } return false, err }) if err != nil { t.Fatal(err) } if _, ok := configmap.Data["client-ca-file"]; !ok { t.Fatal("missing client-ca-file") } }
explode_data.jsonl/5914
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 350 }
[ 2830, 3393, 12049, 2537, 1637, 2836, 2648, 2227, 1155, 353, 8840, 836, 8, 341, 2109, 2300, 2648, 11, 10652, 7210, 42, 3760, 2648, 11, 1848, 1669, 1273, 4030, 12101, 2271, 18041, 741, 743, 1848, 961, 2092, 341, 197, 3244, 30762, 445, 5...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestRegisterContext(t *testing.T) { assert := tdd.New(t) id, err := NewIdentifierWithMode("bryk", "sample-network", ModeUUID) if err != nil { assert.Fail(err.Error()) return } // Add a couple of keys assert.Nil(id.AddNewVerificationMethod("key-1", KeyTypeEd), "add key error") id.AddService(&ServiceEndpoint{ ID: "my-service", Type: "acme-service", Endpoint: "https://acme.com/my-service", Extensions: []Extension{ { ID: "custom.extension", Version: "0.1.0", Data: map[string]string{ "address": "Q4HSY6GM7AJGVSZGWPI5NZW2TJ4SIFHPSBXG4MCL72B5DAJL3PCCXIE3HI", "asset": "ALGO", "network": "testnet", }, }, }, }) // Register custom context // extContext := make(map[string]interface{}) // _ = json.Unmarshal([]byte(extV1), &extContext) id.RegisterContext(extV1Context) // JSON encode/decode doc := id.Document(true) js, err := json.MarshalIndent(doc, "", " ") assert.Nil(err) assert.NotZero(len(js)) // _ = ioutil.WriteFile("testdata/sample.json", js, 0644) // Restore id from document id2, err := FromDocument(doc) assert.Nil(err, "restore from document failed") doc2 := id2.Document(true) assert.Equal(doc, doc2, "invalid document contents") _, err = doc.NormalizedLD() assert.Nil(err, "normalized doc") _, err = doc.ExpandedLD() assert.Nil(err, "expanded doc") }
explode_data.jsonl/37745
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 589 }
[ 2830, 3393, 8690, 1972, 1155, 353, 8840, 836, 8, 341, 6948, 1669, 259, 631, 7121, 1155, 340, 15710, 11, 1848, 1669, 1532, 8714, 2354, 3636, 445, 65, 884, 74, 497, 330, 13611, 56732, 497, 14562, 24754, 340, 743, 1848, 961, 2092, 341, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestMaxLineLengthInvalidSpec(t *testing.T) { ctx := context.TODO() for _, f := range []string{"c"} { errs := eclint.Lint(ctx, fmt.Sprintf("./testdata/max_line_length/%s", f)) if len(errs) == 0 { t.Errorf("one error was expected, got none") } } }
explode_data.jsonl/82395
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 113 }
[ 2830, 3393, 5974, 2460, 4373, 7928, 8327, 1155, 353, 8840, 836, 8, 341, 20985, 1669, 2266, 90988, 2822, 2023, 8358, 282, 1669, 2088, 3056, 917, 4913, 66, 9207, 341, 197, 9859, 82, 1669, 59958, 396, 1214, 396, 7502, 11, 8879, 17305, 13...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestHtlcIncomingResolverFwdTimeout(t *testing.T) { t.Parallel() defer timeout(t)() ctx := newIncomingResolverTestContext(t, true) ctx.witnessBeacon.lookupPreimage[testResHash] = testResPreimage ctx.resolver.htlcExpiry = 90 ctx.resolve() ctx.waitForResult(false) }
explode_data.jsonl/30612
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 108 }
[ 2830, 3393, 39, 11544, 66, 97564, 18190, 37, 6377, 7636, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 741, 16867, 9632, 1155, 8, 2822, 20985, 1669, 501, 97564, 18190, 2271, 1972, 1155, 11, 830, 340, 20985, 1418, 8091, 3430, 22379, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestWhereAndSelect(t *testing.T) { // 筛选name为mark的获取books的第一条 result := From(data).Where(func(i interface{}) bool { return i.(*TestModel).Name == "mark" }).Select(func(i interface{}) interface{} { return i.(*TestModel).Books }).First() m := result.([]TestBook) for _, s := range m { t.Log(s.BookName) t.Log(s.BookPrice) } }
explode_data.jsonl/943
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 154 }
[ 2830, 3393, 9064, 3036, 3379, 1155, 353, 8840, 836, 8, 1476, 197, 322, 10236, 255, 249, 30767, 606, 17714, 3987, 9370, 45912, 12110, 105525, 38989, 198, 9559, 1669, 5542, 2592, 568, 9064, 18552, 1956, 3749, 28875, 1807, 341, 197, 853, 6...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestBuildOutputSet(t *testing.T) { var tests = []struct { description string buildOutputBytes []byte setValue string shouldErr bool expectedBuildOutput BuildOutput }{ { description: "set returns correct build output format for json", buildOutputBytes: []byte(`{ "builds": [{ "imageName": "gcr.io/k8s/test1", "tag": "sha256@foo" }, { "imageName": "gcr.io/k8s/test2", "tag": "sha256@bar" }] }`), setValue: "test.in", expectedBuildOutput: BuildOutput{ Builds: []build.Artifact{{ ImageName: "gcr.io/k8s/test1", Tag: "sha256@foo", }, { ImageName: "gcr.io/k8s/test2", Tag: "sha256@bar", }}, }, }, { description: "set errors with in-correct build output format", buildOutputBytes: []byte{}, setValue: "test.in", shouldErr: true, }, { description: "set should error when file is not present with original flag value", buildOutputBytes: nil, setValue: "does_not_exist.in", shouldErr: true, }, } for _, test := range tests { testutil.Run(t, test.description, func(t *testutil.T) { dir := t.NewTempDir() flag := NewBuildOutputFileFlag("") if test.buildOutputBytes != nil { dir.Write(test.setValue, string(test.buildOutputBytes)) } expectedFlag := &BuildOutputFileFlag{ filename: test.setValue, buildOutput: test.expectedBuildOutput, } err := flag.Set(dir.Path(test.setValue)) t.CheckErrorAndDeepEqual(test.shouldErr, err, expectedFlag.buildOutput, flag.buildOutput) }) } }
explode_data.jsonl/37829
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 718 }
[ 2830, 3393, 11066, 5097, 1649, 1155, 353, 8840, 836, 8, 341, 2405, 7032, 284, 3056, 1235, 341, 197, 42407, 260, 914, 198, 197, 69371, 5097, 7078, 262, 3056, 3782, 198, 197, 8196, 1130, 310, 914, 198, 197, 197, 5445, 7747, 1843, 1807, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestTopologicalSort(t *testing.T) { h := graph.NewDirected() addEdge := func(h *graph.DirGraph, i, j int) { h.AddEdge(graph.VertexId(i), graph.VertexId(j), 1) } for i := 1; i < 10; i++ { h.AddVertex(graph.VertexId(i)) } addEdge(h, 1, 7) addEdge(h, 7, 4) addEdge(h, 4, 1) addEdge(h, 7, 9) addEdge(h, 9, 6) addEdge(h, 6, 3) addEdge(h, 3, 9) addEdge(h, 6, 8) addEdge(h, 5, 8) addEdge(h, 2, 5) addEdge(h, 8, 2) dfs.DirectedDfs(h, graph.VertexId(9), func(v graph.VertexId) { //fmt.Println(v) }) s := Scc(h) fmt.Println(s) }
explode_data.jsonl/45344
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 294 }
[ 2830, 3393, 5366, 5729, 10231, 1155, 353, 8840, 836, 8, 341, 9598, 1669, 4771, 7121, 92669, 741, 12718, 11656, 1669, 2915, 3203, 353, 4439, 83757, 11212, 11, 600, 11, 502, 526, 8, 341, 197, 9598, 1904, 11656, 24312, 72594, 764, 1956, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestParseObject(t *testing.T) { doTestParseObjectOK("null ", t) doTestParseObjectOK("true ", t) doTestParseObjectOK("[true%comment\x0Anull]", t) doTestParseObjectOK("[[%comment\x0dnull][%empty\x0A\x0Dtrue]false%comment\x0A]", t) doTestParseObjectOK("<<>>", t) doTestParseObjectOK("<</Key %comment\x0a true%comment \x0a\x0d>>", t) doTestParseObjectOK("<</Key/Value>>", t) doTestParseObjectOK("<</Key[/Val1/Val2\x0d%gopher\x0atrue]>>", t) doTestParseObjectOK("[<</k1[/name1]>><</k1[false true null]>>]", t) doTestParseObjectOK("/Name ", t) doTestParseObjectFail("/Na#me", t) doTestParseObjectFail("/Na#2me", t) doTestParseObjectOK("/Na#20me", t) doTestParseObjectOK("[null]abc", t) doTestParseObjectFail("/", t) doTestParseObjectOK("/(", t) doTestParseObjectOK("//", t) doTestParseObjectOK("/abc/", t) doTestParseObjectOK("/abc", t) doTestParseObjectOK("/abc/def", t) doTestParseObjectOK("%comment\x0D<c0c>%\x0a", t) doTestParseObjectOK("[<0ab>%comment\x0a]", t) doTestParseObjectOK("<</Key1<abc>/Key2<def>>>", t) doTestParseObjectOK("<< /Key1 <abc> /Key2 <def> >>", t) doTestParseObjectOK("<</Key1<AB>>>", t) doTestParseObjectOK("<</Key1<ABC>>>", t) doTestParseObjectOK("<</Key1<0ab>>>", t) doTestParseObjectOK("<</Key<>>>", t) doTestParseObjectOK("<>", t) doTestParseObjectOK("()", t) doTestParseObjectOK("(gopher\\\x28go)", t) doTestParseObjectOK("(gop\x0aher\\(go)", t) doTestParseObjectOK("(go\\pher\\)go)", t) doTestParseObjectOK("[%comment\x0d(gopher\\ago)%comment\x0a]", t) doTestParseObjectOK("()", t) doTestParseObjectOK("<</K(gopher)>>", t) doTestParseObjectOK("[(abc)true/n1<20f>]..", t) doTestParseObjectOK("[(abc)()]..", t) doTestParseObjectOK("[<743EEC2AFD93A438D87F5ED3D51166A8><B7FFF0ADB814244ABD8576D07849BE54>]", t) doTestParseObjectOK("1", t) doTestParseObjectOK("1/", t) doTestParseObjectOK("3.43", t) doTestParseObjectOK("3.43<", t) doTestParseObjectOK("1.2", t) doTestParseObjectOK("[<0ab>]", t) doTestParseObjectOK("1 0 R%comment\x0a", t) doTestParseObjectOK("[1 0 R /n 2 0 R]", t) doTestParseObjectOK("<</n 1 0 R>>", t) doTestParseObjectOK("(!\\(S:\\356[\\272H\\355>>R{sb\\007)", t) }
explode_data.jsonl/62472
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1033 }
[ 2830, 3393, 14463, 1190, 1155, 353, 8840, 836, 8, 1476, 19935, 2271, 14463, 1190, 3925, 445, 2921, 414, 3670, 259, 340, 19935, 2271, 14463, 1190, 3925, 445, 1866, 257, 3670, 259, 340, 19935, 2271, 14463, 1190, 3925, 10937, 1866, 4, 6182...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestAddFixedPoint(t *testing.T) { assert := test.NewAssert(t) var circuit, witness add // generate a random point, and compute expected_point = base + random_point params, err := NewEdCurve(ecc.BN254) if err != nil { t.Fatal(err) } var base, point, expected twistededwards.PointAffine base.X.SetBigInt(&params.BaseX) base.Y.SetBigInt(&params.BaseY) point.Set(&base) r := big.NewInt(5) point.ScalarMul(&point, r) expected.Add(&base, &point) // populate witness witness.P.X.Assign(point.X.String()) witness.P.Y.Assign(point.Y.String()) witness.E.X.Assign(expected.X.String()) witness.E.Y.Assign(expected.Y.String()) // creates r1cs assert.SolvingSucceeded(&circuit, &witness, test.WithCurves(ecc.BN254)) }
explode_data.jsonl/1608
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 294 }
[ 2830, 3393, 2212, 13520, 2609, 1155, 353, 8840, 836, 8, 1476, 6948, 1669, 1273, 7121, 8534, 1155, 692, 2405, 16224, 11, 11298, 912, 271, 197, 322, 6923, 264, 4194, 1459, 11, 323, 12564, 3601, 6085, 284, 2331, 488, 4194, 6085, 198, 258...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestCacheKVMergeIteratorBasics(t *testing.T) { st := newCacheKVStore() // set and delete an item in the cache, iterator should be empty k, v := keyFmt(0), valFmt(0) st.Set(k, v) st.Delete(k) assertIterateDomain(t, st, 0) // now set it and assert its there st.Set(k, v) assertIterateDomain(t, st, 1) // write it and assert its there st.Write() assertIterateDomain(t, st, 1) // remove it in cache and assert its not st.Delete(k) assertIterateDomain(t, st, 0) // write the delete and assert its not there st.Write() assertIterateDomain(t, st, 0) // add two keys and assert theyre there k1, v1 := keyFmt(1), valFmt(1) st.Set(k, v) st.Set(k1, v1) assertIterateDomain(t, st, 2) // write it and assert theyre there st.Write() assertIterateDomain(t, st, 2) // remove one in cache and assert its not st.Delete(k1) assertIterateDomain(t, st, 1) // write the delete and assert its not there st.Write() assertIterateDomain(t, st, 1) // delete the other key in cache and asserts its empty st.Delete(k) assertIterateDomain(t, st, 0) }
explode_data.jsonl/6651
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 410 }
[ 2830, 3393, 8233, 42, 11187, 10080, 11951, 33603, 1211, 1155, 353, 8840, 836, 8, 341, 18388, 1669, 501, 8233, 82707, 6093, 2822, 197, 322, 738, 323, 3698, 458, 1509, 304, 279, 6500, 11, 15091, 1265, 387, 4287, 198, 16463, 11, 348, 166...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestTaskUpdateKnownStatusChecksSteadyStateWhenSetToRunning(t *testing.T) { testTask := &Task{ KnownStatusUnsafe: apitaskstatus.TaskStatusNone, Containers: []*apicontainer.Container{ { KnownStatusUnsafe: apicontainerstatus.ContainerCreated, }, { KnownStatusUnsafe: apicontainerstatus.ContainerRunning, }, { KnownStatusUnsafe: apicontainerstatus.ContainerRunning, }, }, } // One of the containers is in CREATED state, expect task to be updated // to apitaskstatus.TaskCreated newStatus := testTask.updateTaskKnownStatus() assert.Equal(t, apitaskstatus.TaskCreated, newStatus, "Incorrect status returned: %s", newStatus.String()) assert.Equal(t, apitaskstatus.TaskCreated, testTask.GetKnownStatus()) // All of the containers are in RUNNING state, expect task to be updated // to apitaskstatus.TaskRunning testTask.Containers[0].SetKnownStatus(apicontainerstatus.ContainerRunning) newStatus = testTask.updateTaskKnownStatus() assert.Equal(t, apitaskstatus.TaskRunning, newStatus, "Incorrect status returned: %s", newStatus.String()) assert.Equal(t, apitaskstatus.TaskRunning, testTask.GetKnownStatus()) }
explode_data.jsonl/37217
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 382 }
[ 2830, 3393, 6262, 4289, 48206, 2522, 49820, 623, 3149, 88, 1397, 4498, 1649, 1249, 18990, 1155, 353, 8840, 836, 8, 341, 18185, 6262, 1669, 609, 6262, 515, 197, 39340, 4169, 2522, 78770, 25, 1443, 275, 1073, 2829, 28258, 2522, 4064, 345,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestReadInvalid(t *testing.T) { t.Run("validate did:key method specific ID", func(t *testing.T) { v := New() doc, err := v.Read("did:key:invalid") require.Error(t, err) require.Contains(t, err.Error(), "invalid did:key method ID: invalid") require.Nil(t, doc) }) t.Run("validate not supported public key", func(t *testing.T) { v := New() doc, err := v.Read("did:key:z6LSbysY2xFMRpGMhb7tFTLMpeuPRaqaWM1yECx2AtzE3KCc") require.Error(t, err) require.Contains(t, err.Error(), "unsupported key multicodec code [0xec]") // Curve25519 public key require.Nil(t, doc) }) t.Run("validate did:key", func(t *testing.T) { v := New() doc, err := v.Read("invalid") require.Error(t, err) require.Contains(t, err.Error(), "invalid did: invalid") require.Nil(t, doc) }) t.Run("validate an invalid did method", func(t *testing.T) { v := New() doc, err := v.Read("did:invalid:z6MkpTHR8VNsBxYAAWHut2Geadd9jSwuBV8xRoAnwWsdvktH") require.Error(t, err) require.Contains(t, err.Error(), "invalid did:key method: invalid") require.Nil(t, doc) }) }
explode_data.jsonl/16603
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 474 }
[ 2830, 3393, 4418, 7928, 1155, 353, 8840, 836, 8, 341, 3244, 16708, 445, 7067, 1521, 64849, 1714, 3151, 3034, 497, 2915, 1155, 353, 8840, 836, 8, 341, 197, 5195, 1669, 1532, 2822, 197, 59536, 11, 1848, 1669, 348, 6503, 445, 22920, 6484...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestWSServerReportUpgradeFailure(t *testing.T) { o := testWSOptions() s := RunServer(o) defer s.Shutdown() logger := &captureErrorLogger{errCh: make(chan string, 1)} s.SetLogger(logger, false, false) addr := fmt.Sprintf("%s:%d", o.Websocket.Host, o.Websocket.Port) req := testWSCreateValidReq() req.URL, _ = url.Parse("wss://" + addr) wsc, err := net.Dial("tcp", addr) if err != nil { t.Fatalf("Error creating ws connection: %v", err) } defer wsc.Close() wsc = tls.Client(wsc, &tls.Config{InsecureSkipVerify: true}) if err := wsc.(*tls.Conn).Handshake(); err != nil { t.Fatalf("Error during handshake: %v", err) } // Remove a required field from the request to have it fail req.Header.Del("Connection") // Send the request if err := req.Write(wsc); err != nil { t.Fatalf("Error sending request: %v", err) } br := bufio.NewReader(wsc) resp, err := http.ReadResponse(br, req) if err != nil { t.Fatalf("Error reading response: %v", err) } defer resp.Body.Close() if resp.StatusCode != http.StatusBadRequest { t.Fatalf("Expected status %v, got %v", http.StatusBadRequest, resp.StatusCode) } // Check that server logs error select { case e := <-logger.errCh: if !strings.Contains(e, "invalid value for header 'Connection'") { t.Fatalf("Unexpected error: %v", e) } case <-time.After(time.Second): t.Fatalf("Should have timed-out") } }
explode_data.jsonl/42719
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 543 }
[ 2830, 3393, 54, 1220, 2836, 10361, 43861, 17507, 1155, 353, 8840, 836, 8, 341, 22229, 1669, 1273, 7433, 3798, 741, 1903, 1669, 6452, 5475, 10108, 340, 16867, 274, 10849, 18452, 2822, 17060, 1669, 609, 45070, 1454, 7395, 90, 615, 1143, 2...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
9
func TestBlockPullerFailover(t *testing.T) { //脚本: //预计拉块器将拉块1至3。 //有两个排序节点,但一开始只有节点1可用。 //拉块器首先与之相连,但当它拉动第一块时, //它崩溃了。 //然后生成第二个排序器,并期望块拉具 //连接到它并拉动其余的块。 osn1 := newClusterNode(t) osn1.addExpectProbeAssert() osn1.addExpectPullAssert(1) osn1.enqueueResponse(3) osn1.enqueueResponse(1) osn2 := newClusterNode(t) defer osn2.stop() osn2.addExpectProbeAssert() osn2.addExpectPullAssert(2) //第一个反应是探针 osn2.enqueueResponse(3) //接下来的两个响应是拉动,而第一个块 //被跳过,因为它应该是从节点1检索到的 osn2.enqueueResponse(2) osn2.enqueueResponse(3) //首先,我们停止节点2以确保块拉具在创建时无法连接到它。 osn2.stop() dialer := newCountingDialer() bp := newBlockPuller(dialer, osn1.srv.Address(), osn2.srv.Address()) //我们不想依赖于获取超时,而是纯故障转移逻辑, //所以让获取超时变得很大 bp.FetchTimeout = time.Hour //配置块拉器记录器,以便在块拉器出现后向等待组发送信号 //收到第一个块。 var pulledBlock1 sync.WaitGroup pulledBlock1.Add(1) bp.Logger = bp.Logger.WithOptions(zap.Hooks(func(entry zapcore.Entry) error { if strings.Contains(entry.Message, "Got block 1 of size") { pulledBlock1.Done() } return nil })) go func() { //等待拉块器拉动第一个块 pulledBlock1.Wait() //现在,崩溃节点1并恢复节点2 osn1.stop() osn2.resurrect() }() //断言接收1至3区 assert.Equal(t, uint64(1), bp.PullBlock(uint64(1)).Header.Number) assert.Equal(t, uint64(2), bp.PullBlock(uint64(2)).Header.Number) assert.Equal(t, uint64(3), bp.PullBlock(uint64(3)).Header.Number) bp.Close() dialer.assertAllConnectionsClosed(t) }
explode_data.jsonl/47274
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1109 }
[ 2830, 3393, 4713, 36068, 261, 19524, 1975, 1155, 353, 8840, 836, 8, 341, 322, 100037, 21894, 28311, 322, 102042, 72225, 99922, 31548, 44063, 72225, 99922, 16, 56137, 18, 8997, 322, 108534, 74661, 92374, 3837, 77288, 102863, 101043, 92374, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestDisplay(t *testing.T) { t.Parallel() pair := NewCurrencyPairDelimiter("BTC-USD", "-") actual := pair.Pair() expected := CurrencyItem("BTC-USD") if actual != expected { t.Errorf( "Test failed. Pair(): %s was not equal to expected value: %s", actual, expected, ) } actual = pair.Display("", false) expected = CurrencyItem("btcusd") if actual != expected { t.Errorf( "Test failed. Pair(): %s was not equal to expected value: %s", actual, expected, ) } actual = pair.Display("~", true) expected = CurrencyItem("BTC~USD") if actual != expected { t.Errorf( "Test failed. Pair(): %s was not equal to expected value: %s", actual, expected, ) } }
explode_data.jsonl/55830
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 260 }
[ 2830, 3393, 7020, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 741, 3223, 1310, 1669, 1532, 26321, 12443, 91098, 445, 59118, 12, 26749, 497, 6523, 1138, 88814, 1669, 6716, 1069, 1310, 741, 42400, 1669, 28453, 1234, 445, 59118, 12, 2...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
4
func TestSumPerKeyCrossPartitionContributionBoundingFloat(t *testing.T) { // triples contains {1,0,1.0}, {2,0,1.0}, …, {50,0,1.0}, {1,1,1.0}, …, {50,1,1.0}, {1,2,1.0}, …, {50,9,1.0}. var triples []testutils.TripleWithFloatValue for i := 0; i < 10; i++ { triples = append(triples, testutils.MakeSampleTripleWithFloatValue(50, i)...) } result := []testutils.TestFloat64Metric{ {0, 150.0}, } p, s, col, want := ptest.CreateList2(triples, result) col = beam.ParDo(s, testutils.ExtractIDFromTripleWithFloatValue, col) // ε=50, δ=0.01 and l0Sensitivity=3 gives a threshold of 3. // We have 10 partitions. So, to get an overall flakiness of 10⁻²³, // we need to have each partition pass with 1-10⁻²⁵ probability (k=25). epsilon, delta, k, l1Sensitivity := 50.0, 0.01, 25.0, 3.0 pcol := MakePrivate(s, col, NewPrivacySpec(epsilon, delta)) pcol = ParDo(s, testutils.TripleWithFloatValueToKV, pcol) got := SumPerKey(s, pcol, SumParams{MaxPartitionsContributed: 3, MinValue: 0.0, MaxValue: 1.0, NoiseKind: LaplaceNoise{}}) // With a max contribution of 3, 70% of the data should have be // dropped. The sum of all elements must then be 150. counts := beam.DropKey(s, got) sumOverPartitions := stats.Sum(s, counts) got = beam.AddFixedKey(s, sumOverPartitions) // Adds a fixed key of 0. want = beam.ParDo(s, testutils.Float64MetricToKV, want) if err := testutils.ApproxEqualsKVFloat64(s, got, want, testutils.LaplaceTolerance(k, l1Sensitivity, epsilon)); err != nil { t.Fatalf("TestSumPerKeyCrossPartitionContributionBoundingFloat: %v", err) } if err := ptest.Run(p); err != nil { t.Errorf("TestSumPerKeyCrossPartitionContributionBoundingFloat: SumPerKey(%v) = %v, expected elements to sum to 150.0: %v", col, got, err) } }
explode_data.jsonl/42967
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 689 }
[ 2830, 3393, 9190, 3889, 1592, 28501, 49978, 1109, 31140, 37909, 5442, 1155, 353, 8840, 836, 8, 341, 197, 322, 88561, 5610, 314, 16, 11, 15, 11, 16, 13, 15, 2137, 314, 17, 11, 15, 11, 16, 13, 15, 2137, 4593, 11, 314, 20, 15, 11, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
4
func TestCheckInNewProbeServicesFailure(t *testing.T) { sess, err := NewSession() if err != nil { t.Fatal(err) } sess.TestingCheckInBeforeNewProbeServicesClient = func(ctx *oonimkall.Context) { ctx.Cancel() // cancel execution } ctx := sess.NewContext() config := oonimkall.CheckInConfig{ Charging: true, OnWiFi: true, Platform: "android", RunType: "timed", SoftwareName: "ooniprobe-android", SoftwareVersion: "2.7.1", WebConnectivity: &oonimkall.CheckInConfigWebConnectivity{}, } config.WebConnectivity.Add("NEWS") config.WebConnectivity.Add("CULTR") result, err := sess.CheckIn(ctx, &config) if !errors.Is(err, engine.ErrAllProbeServicesFailed) { t.Fatalf("not the error we expected: %+v", err) } if result != nil { t.Fatal("expected nil result here") } }
explode_data.jsonl/78958
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 344 }
[ 2830, 3393, 3973, 641, 3564, 81426, 11025, 17507, 1155, 353, 8840, 836, 8, 341, 1903, 433, 11, 1848, 1669, 1532, 5283, 741, 743, 1848, 961, 2092, 341, 197, 3244, 26133, 3964, 340, 197, 532, 1903, 433, 8787, 287, 3973, 641, 10227, 3564...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestHealthCheck(t *testing.T) { ts := memorytopo.NewServer("cell") hc := createTestHc(ts) // close healthcheck defer hc.Close() tablet := topo.NewTablet(0, "cell", "a") tablet.Keyspace = "k" tablet.Shard = "s" tablet.PortMap["vt"] = 1 tablet.Type = topodatapb.TabletType_REPLICA input := make(chan *querypb.StreamHealthResponse) conn := createFakeConn(tablet, input) // create a channel and subscribe to healthcheck resultChan := hc.Subscribe() testChecksum(t, 0, hc.stateChecksum()) hc.AddTablet(tablet) testChecksum(t, 1027934207, hc.stateChecksum()) // Immediately after AddTablet() there will be the first notification. want := &TabletHealth{ Tablet: tablet, Target: &querypb.Target{Keyspace: "k", Shard: "s", TabletType: topodatapb.TabletType_REPLICA}, Serving: false, Stats: nil, MasterTermStartTime: 0, } result := <-resultChan mustMatch(t, want, result, "Wrong TabletHealth data") shr := &querypb.StreamHealthResponse{ TabletAlias: tablet.Alias, Target: &querypb.Target{Keyspace: "k", Shard: "s", TabletType: topodatapb.TabletType_REPLICA}, Serving: true, TabletExternallyReparentedTimestamp: 0, RealtimeStats: &querypb.RealtimeStats{SecondsBehindMaster: 1, CpuUsage: 0.5}, } input <- shr result = <-resultChan want = &TabletHealth{ Tablet: tablet, Target: &querypb.Target{Keyspace: "k", Shard: "s", TabletType: topodatapb.TabletType_REPLICA}, Serving: true, Stats: &querypb.RealtimeStats{SecondsBehindMaster: 1, CpuUsage: 0.5}, MasterTermStartTime: 0, } // create a context with timeout and select on it and channel mustMatch(t, want, result, "Wrong TabletHealth data") tcsl := hc.CacheStatus() tcslWant := TabletsCacheStatusList{{ Cell: "cell", Target: want.Target, TabletsStats: TabletStatsList{{ Tablet: tablet, Target: want.Target, Serving: true, Stats: &querypb.RealtimeStats{SecondsBehindMaster: 1, CpuUsage: 0.5}, MasterTermStartTime: 0, }}, }} // we can't use assert.Equal here because of the special way we want to compare equality assert.True(t, tcslWant.deepEqual(tcsl), "Incorrect cache status:\n Expected: %+v\n Actual: %+v", tcslWant[0], tcsl[0]) testChecksum(t, 3487343103, hc.stateChecksum()) // TabletType changed, should get both old and new event shr = &querypb.StreamHealthResponse{ TabletAlias: tablet.Alias, Target: &querypb.Target{Keyspace: "k", Shard: "s", TabletType: topodatapb.TabletType_MASTER}, Serving: true, TabletExternallyReparentedTimestamp: 10, RealtimeStats: &querypb.RealtimeStats{SecondsBehindMaster: 1, CpuUsage: 0.2}, } want = &TabletHealth{ Tablet: tablet, Target: &querypb.Target{ Keyspace: "k", Shard: "s", TabletType: topodatapb.TabletType_MASTER, }, Serving: true, Conn: conn, Stats: &querypb.RealtimeStats{SecondsBehindMaster: 1, CpuUsage: 0.2}, MasterTermStartTime: 10, } input <- shr result = <-resultChan mustMatch(t, want, result, "Wrong TabletHealth data") testChecksum(t, 1780128002, hc.stateChecksum()) err := checkErrorCounter("k", "s", topodatapb.TabletType_MASTER, 0) require.NoError(t, err, "error checking error counter") // Serving & RealtimeStats changed shr = &querypb.StreamHealthResponse{ TabletAlias: tablet.Alias, Target: &querypb.Target{Keyspace: "k", Shard: "s", TabletType: topodatapb.TabletType_REPLICA}, Serving: false, TabletExternallyReparentedTimestamp: 0, RealtimeStats: &querypb.RealtimeStats{SecondsBehindMaster: 1, CpuUsage: 0.3}, } want = &TabletHealth{ Tablet: tablet, Target: &querypb.Target{Keyspace: "k", Shard: "s", TabletType: topodatapb.TabletType_REPLICA}, Serving: false, Stats: &querypb.RealtimeStats{SecondsBehindMaster: 1, CpuUsage: 0.3}, MasterTermStartTime: 0, } input <- shr result = <-resultChan mustMatch(t, want, result, "Wrong TabletHealth data") testChecksum(t, 1027934207, hc.stateChecksum()) // HealthError shr = &querypb.StreamHealthResponse{ TabletAlias: tablet.Alias, Target: &querypb.Target{Keyspace: "k", Shard: "s", TabletType: topodatapb.TabletType_REPLICA}, Serving: true, TabletExternallyReparentedTimestamp: 0, RealtimeStats: &querypb.RealtimeStats{HealthError: "some error", SecondsBehindMaster: 1, CpuUsage: 0.3}, } want = &TabletHealth{ Tablet: tablet, Target: &querypb.Target{Keyspace: "k", Shard: "s", TabletType: topodatapb.TabletType_REPLICA}, Serving: false, Stats: &querypb.RealtimeStats{HealthError: "some error", SecondsBehindMaster: 1, CpuUsage: 0.3}, MasterTermStartTime: 0, LastError: fmt.Errorf("vttablet error: some error"), } input <- shr result = <-resultChan //TODO: figure out how to compare objects that contain errors using utils.MustMatch assert.True(t, want.DeepEqual(result), "Wrong TabletHealth data\n Expected: %v\n Actual: %v", want, result) testChecksum(t, 1027934207, hc.stateChecksum()) // unchanged // remove tablet hc.deleteTablet(tablet) testChecksum(t, 0, hc.stateChecksum()) }
explode_data.jsonl/47684
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 2621 }
[ 2830, 3393, 14542, 3973, 1155, 353, 8840, 836, 8, 341, 57441, 1669, 4938, 3481, 78, 7121, 5475, 445, 5873, 1138, 9598, 66, 1669, 1855, 2271, 39, 66, 35864, 340, 197, 322, 3265, 2820, 2028, 198, 16867, 50394, 10421, 741, 26481, 83, 166...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestGenerateTypeNames(t *testing.T) { test.TestTypeNameCodegen(t, "go", func(pkg *schema.Package) test.TypeNameGeneratorFunc { err := pkg.ImportLanguages(map[string]schema.Language{"go": Importer}) require.NoError(t, err) var goPkgInfo GoPackageInfo if goInfo, ok := pkg.Language["go"].(GoPackageInfo); ok { goPkgInfo = goInfo } packages := generatePackageContextMap("test", pkg, goPkgInfo) root, ok := packages[""] require.True(t, ok) return func(t schema.Type) string { return root.typeString(t) } }) }
explode_data.jsonl/22935
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 210 }
[ 2830, 3393, 31115, 929, 7980, 1155, 353, 8840, 836, 8, 341, 18185, 8787, 39429, 2078, 4370, 1155, 11, 330, 3346, 497, 2915, 68780, 353, 17349, 49834, 8, 1273, 10184, 675, 12561, 9626, 341, 197, 9859, 1669, 24793, 67275, 59286, 9147, 140...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestQuerier_Proxy(t *testing.T) { files, err := filepath.Glob("testdata/promql/**/*.test") testutil.Ok(t, err) testutil.Equals(t, 10, len(files), "%v", files) logger := log.NewLogfmtLogger(os.Stderr) t.Run("proxy", func(t *testing.T) { var clients []store.Client q := NewQueryableCreator( logger, nil, store.NewProxyStore(logger, nil, func() []store.Client { return clients }, component.Debug, nil, 5*time.Minute), 1000000, 5*time.Minute, ) createQueryableFn := func(stores []*testStore) storage.Queryable { clients = clients[:0] for i, st := range stores { m, err := storepb.PromMatchersToMatchers(st.matchers...) testutil.Ok(t, err) // TODO(bwplotka): Parse external labels. clients = append(clients, inProcessClient{ t: t, StoreClient: storepb.ServerAsClient(SelectedStore(store.NewTSDBStore(logger, st.storage.DB, component.Debug, nil), m, st.mint, st.maxt), 0), name: fmt.Sprintf("store number %v", i), }) } return q(true, nil, nil, 0, false, false) } for _, fn := range files { t.Run(fn, func(t *testing.T) { te, err := newTestFromFile(t, fn) testutil.Ok(t, err) testutil.Ok(t, te.run(createQueryableFn)) te.close() }) } }) }
explode_data.jsonl/42129
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 567 }
[ 2830, 3393, 2183, 261, 1268, 16670, 4130, 1155, 353, 8840, 836, 8, 341, 74075, 11, 1848, 1669, 26054, 1224, 1684, 445, 92425, 76951, 1470, 52565, 1944, 1138, 18185, 1314, 54282, 1155, 11, 1848, 340, 18185, 1314, 16207, 1155, 11, 220, 16...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestParseDocumentError(t *testing.T) { err := &ParseDocumentError{err: errors.New("mock parse doc error")} recieved := err.Error() expected := "package pars: mock parse doc error" if recieved != expected { t.Errorf("incorrect error message, received: %s, expected: %s", recieved, expected) } }
explode_data.jsonl/25419
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 100 }
[ 2830, 3393, 14463, 7524, 1454, 1155, 353, 8840, 836, 8, 341, 9859, 1669, 609, 14463, 7524, 1454, 90, 615, 25, 5975, 7121, 445, 16712, 4715, 4629, 1465, 899, 630, 67904, 30977, 1669, 1848, 6141, 741, 42400, 1669, 330, 1722, 10154, 25, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestBuildConfigWithConfigMaps(t *testing.T) { url, err := git.Parse("https://github.com/openshift/origin.git") if err != nil { t.Fatalf("unexpected error: %v", err) } source := &SourceRef{URL: url, ConfigMaps: []buildv1.ConfigMapBuildSource{ {ConfigMap: corev1.LocalObjectReference{Name: "foo"}, DestinationDir: "/var"}, {ConfigMap: corev1.LocalObjectReference{Name: "bar"}}, }} build := &BuildRef{Source: source} config, err := build.BuildConfig() if err != nil { t.Fatalf("unexpected error: %v", err) } configMaps := config.Spec.Source.ConfigMaps if got := len(configMaps); got != 2 { t.Errorf("expected 2 source configMaps in build config, got %d", got) } }
explode_data.jsonl/17582
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 246 }
[ 2830, 3393, 11066, 2648, 2354, 2648, 36562, 1155, 353, 8840, 836, 8, 341, 19320, 11, 1848, 1669, 16345, 8937, 445, 2428, 1110, 5204, 905, 14, 24175, 47833, 14, 8611, 32799, 1138, 743, 1848, 961, 2092, 341, 197, 3244, 30762, 445, 53859, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
4
func TestClient_Query_noDataWithErrorResponse(t *testing.T) { mux := http.NewServeMux() mux.HandleFunc("/graphql", func(w http.ResponseWriter, req *http.Request) { w.Header().Set("Content-Type", "application/json") mustWrite(w, `{ "errors": [ { "message": "Field 'user' is missing required arguments: login", "locations": [ { "line": 7, "column": 3 } ] } ] }`) }) client := graphql.NewClient("/graphql", &http.Client{Transport: localRoundTripper{handler: mux}}) var q struct { User struct { Name graphql.String } } err := client.Query(context.Background(), &q, nil) if err == nil { t.Fatal("got error: nil, want: non-nil") } if got, want := err.Error(), "Field 'user' is missing required arguments: login"; got != want { t.Errorf("got error: %v, want: %v", got, want) } if q.User.Name != "" { t.Errorf("got non-empty q.User.Name: %v", q.User.Name) } }
explode_data.jsonl/81195
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 405 }
[ 2830, 3393, 2959, 48042, 6536, 1043, 2354, 55901, 1155, 353, 8840, 836, 8, 341, 2109, 2200, 1669, 1758, 7121, 60421, 44, 2200, 741, 2109, 2200, 63623, 4283, 38294, 497, 2915, 3622, 1758, 37508, 11, 4232, 353, 1254, 9659, 8, 341, 197, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestSyncSubmarinerConfig(t *testing.T) { now := metav1.Now() cases := []struct { name string queueKey string configs []runtime.Object clusters []runtime.Object expectedErr bool validateActions func(t *testing.T, configActions []clienttesting.Action) }{ { name: "no submariner config", queueKey: "cluster1", configs: []runtime.Object{}, clusters: []runtime.Object{ &clusterv1.ManagedCluster{ ObjectMeta: metav1.ObjectMeta{ Name: "cluster1", }, }, }, validateActions: func(t *testing.T, configActions []clienttesting.Action) { testinghelpers.AssertNoActions(t, configActions) }, }, { name: "too many configs", queueKey: "", configs: []runtime.Object{ &configv1alpha1.SubmarinerConfig{ ObjectMeta: metav1.ObjectMeta{ Name: "submariner-config-1", Namespace: "cluster1", }, }, &configv1alpha1.SubmarinerConfig{ ObjectMeta: metav1.ObjectMeta{ Name: "submariner-config-2", Namespace: "cluster1", }, }, }, clusters: []runtime.Object{ &clusterv1.ManagedCluster{ ObjectMeta: metav1.ObjectMeta{ Name: "cluster1", }, }, }, validateActions: func(t *testing.T, configActions []clienttesting.Action) { testinghelpers.AssertNoActions(t, configActions) }, }, { name: "create a submariner config", queueKey: "cluster1", configs: []runtime.Object{ &configv1alpha1.SubmarinerConfig{ ObjectMeta: metav1.ObjectMeta{ Name: "submariner", Namespace: "cluster1", }, }, }, clusters: []runtime.Object{ &clusterv1.ManagedCluster{ ObjectMeta: metav1.ObjectMeta{ Name: "cluster1", }, }, }, validateActions: func(t *testing.T, configActions []clienttesting.Action) { testinghelpers.AssertActions(t, configActions, "update") updatedObj := configActions[0].(clienttesting.UpdateActionImpl).Object config := updatedObj.(*configv1alpha1.SubmarinerConfig) if len(config.Finalizers) != 1 { t.Errorf("unexpect size of finalizers") } if config.Finalizers[0] != "submarineraddon.open-cluster-management.io/config-cleanup" { t.Errorf("unexpect finalizers") } }, }, { name: "create a submariner config", queueKey: "cluster1/submariner", configs: []runtime.Object{ &configv1alpha1.SubmarinerConfig{ ObjectMeta: metav1.ObjectMeta{ Name: "submariner", Namespace: "cluster1", }, }, }, clusters: []runtime.Object{ &clusterv1.ManagedCluster{ ObjectMeta: metav1.ObjectMeta{ Name: "cluster1", }, }, }, validateActions: func(t *testing.T, configActions []clienttesting.Action) { testinghelpers.AssertActions(t, configActions, "update") updatedObj := configActions[0].(clienttesting.UpdateActionImpl).Object config := updatedObj.(*configv1alpha1.SubmarinerConfig) if len(config.Finalizers) != 1 { t.Errorf("unexpect size of finalizers") } if config.Finalizers[0] != "submarineraddon.open-cluster-management.io/config-cleanup" { t.Errorf("unexpect finalizers") } }, }, { name: "no managed cluster", queueKey: "cluster1/submariner", configs: []runtime.Object{ &configv1alpha1.SubmarinerConfig{ ObjectMeta: metav1.ObjectMeta{ Name: "submariner", Namespace: "cluster1", Finalizers: []string{"submarineraddon.open-cluster-management.io/config-cleanup"}, }, Spec: configv1alpha1.SubmarinerConfigSpec{ CredentialsSecret: &corev1.LocalObjectReference{ Name: "test", }, }, }, }, clusters: []runtime.Object{}, validateActions: func(t *testing.T, configActions []clienttesting.Action) { testinghelpers.AssertNoActions(t, configActions) }, }, { name: "delete a submariner config", queueKey: "cluster1/submariner", configs: []runtime.Object{ &configv1alpha1.SubmarinerConfig{ ObjectMeta: metav1.ObjectMeta{ Name: "submariner", Namespace: "cluster1", DeletionTimestamp: &now, Finalizers: []string{"submarineraddon.open-cluster-management.io/config-cleanup"}, }, Status: configv1alpha1.SubmarinerConfigStatus{ ManagedClusterInfo: configv1alpha1.ManagedClusterInfo{ Platform: "GCP", }, }, }, }, clusters: []runtime.Object{ &clusterv1.ManagedCluster{ ObjectMeta: metav1.ObjectMeta{ Name: "cluster1", Labels: map[string]string{"vendor": "unsupported"}, Finalizers: []string{"cluster.open-cluster-management.io/submariner-config-cleanup"}, }, }, }, validateActions: func(t *testing.T, configActions []clienttesting.Action) { testinghelpers.AssertActions(t, configActions, "update") workUpdatedObj := configActions[0].(clienttesting.UpdateActionImpl).Object config := workUpdatedObj.(*configv1alpha1.SubmarinerConfig) if len(config.Finalizers) != 0 { t.Errorf("unexpect size of finalizers") } }, }, } for _, c := range cases { t.Run(c.name, func(t *testing.T) { configClient := fakeconfigclient.NewSimpleClientset(c.configs...) configInformerFactory := configinformers.NewSharedInformerFactory(configClient, 5*time.Minute) for _, config := range c.configs { _ = configInformerFactory.Submarineraddon().V1alpha1().SubmarinerConfigs().Informer().GetStore().Add(config) } clusterClient := fakeclusterclient.NewSimpleClientset(c.clusters...) clusterInformerFactory := clusterinformers.NewSharedInformerFactory(clusterClient, 5*time.Minute) for _, cluster := range c.clusters { _ = clusterInformerFactory.Cluster().V1().ManagedClusters().Informer().GetStore().Add(cluster) } addOnClient := addonfake.NewSimpleClientset() addOnInformerFactory := addoninformers.NewSharedInformerFactory(addOnClient, time.Minute*10) ctrl := &submarinerAgentController{ kubeClient: kubefake.NewSimpleClientset(), addOnClient: addOnClient, addOnLister: addOnInformerFactory.Addon().V1alpha1().ManagedClusterAddOns().Lister(), clusterClient: clusterClient, configClient: configClient, clusterLister: clusterInformerFactory.Cluster().V1().ManagedClusters().Lister(), clusterSetLister: clusterInformerFactory.Cluster().V1beta1().ManagedClusterSets().Lister(), manifestWorkClient: fakeworkclient.NewSimpleClientset(), configLister: configInformerFactory.Submarineraddon().V1alpha1().SubmarinerConfigs().Lister(), eventRecorder: eventstesting.NewTestingEventRecorder(t), } err := ctrl.sync(context.TODO(), testinghelpers.NewFakeSyncContext(t, c.queueKey)) if c.expectedErr && err == nil { t.Errorf("expect err, but no error") } if !c.expectedErr && err != nil { t.Errorf("unexpect err: %v", err) } c.validateActions(t, configClient.Actions()) }) } }
explode_data.jsonl/6211
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 3096 }
[ 2830, 3393, 12154, 3136, 5612, 10453, 2648, 1155, 353, 8840, 836, 8, 341, 80922, 1669, 77520, 16, 13244, 741, 1444, 2264, 1669, 3056, 1235, 341, 197, 11609, 310, 914, 198, 197, 46993, 1592, 286, 914, 198, 197, 25873, 82, 260, 3056, 22...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestUploadLicenseFile(t *testing.T) { th := Setup().InitBasic().InitSystemAdmin() defer th.TearDown() Client := th.Client ok, resp := Client.UploadLicenseFile([]byte{}) CheckForbiddenStatus(t, resp) if ok { t.Fatal("should fail") } ok, resp = th.SystemAdminClient.UploadLicenseFile([]byte{}) CheckBadRequestStatus(t, resp) if ok { t.Fatal("should fail") } }
explode_data.jsonl/10689
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 141 }
[ 2830, 3393, 13844, 9827, 1703, 1155, 353, 8840, 836, 8, 341, 70479, 1669, 18626, 1005, 3803, 15944, 1005, 3803, 2320, 7210, 741, 16867, 270, 836, 682, 4454, 741, 71724, 1669, 270, 11716, 271, 59268, 11, 9039, 1669, 8423, 86597, 9827, 17...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestFormatMobile(t *testing.T) { for _, tt := range mobFormatTests { number := Parse(tt.input, tt.country) if number != tt.expected { t.Errorf("Parse(number=`%s`, country=`%s`): expected `%s`, actual `%s`", tt.input, tt.country, tt.expected, number) } } }
explode_data.jsonl/58211
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 116 }
[ 2830, 3393, 4061, 18370, 1155, 353, 8840, 836, 8, 341, 2023, 8358, 17853, 1669, 2088, 12595, 4061, 18200, 341, 197, 57135, 1669, 14775, 47152, 10046, 11, 17853, 33324, 340, 197, 743, 1372, 961, 17853, 56835, 341, 298, 3244, 13080, 445, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestGetConfig(t *testing.T) { // case insensitivity for key con := caddy.NewTestController("http", "") con.Key = "foo" cfg := GetConfig(con) con.Key = "FOO" cfg2 := GetConfig(con) if cfg != cfg2 { t.Errorf("Expected same config using same key with different case; got %p and %p", cfg, cfg2) } // make sure different key returns different config con.Key = "foobar" cfg3 := GetConfig(con) if cfg == cfg3 { t.Errorf("Expected different configs using when key is different; got %p and %p", cfg, cfg3) } }
explode_data.jsonl/26463
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 197 }
[ 2830, 3393, 1949, 2648, 1155, 353, 8840, 836, 8, 341, 197, 322, 1142, 1640, 47837, 369, 1376, 198, 37203, 1669, 272, 22478, 7121, 2271, 2051, 445, 1254, 497, 14676, 37203, 9610, 284, 330, 7975, 698, 50286, 1669, 2126, 2648, 17868, 340, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestNasTypeNewPDUSESSIONRELEASEREQUESTMessageIdentity(t *testing.T) { a := nasType.NewPDUSESSIONRELEASEREQUESTMessageIdentity() assert.NotNil(t, a) }
explode_data.jsonl/11125
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 59 }
[ 2830, 3393, 45, 300, 929, 3564, 47, 21547, 6302, 787, 867, 1911, 42172, 6671, 2052, 18558, 1155, 353, 8840, 836, 8, 341, 11323, 1669, 17141, 929, 7121, 47, 21547, 6302, 787, 867, 1911, 42172, 6671, 2052, 18558, 741, 6948, 93882, 1155, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
1
func TestRequestsAcrossRoutes(t *testing.T) { srvA, srvB, optsA, optsB := runServers(t) defer srvA.Shutdown() defer srvB.Shutdown() urlA := fmt.Sprintf("nats://%s:%d/", optsA.Host, optsA.Port) urlB := fmt.Sprintf("nats://%s:%d/", optsB.Host, optsB.Port) nc1, err := nats.Connect(urlA) if err != nil { t.Fatalf("Failed to create connection for nc1: %v\n", err) } defer nc1.Close() nc2, err := nats.Connect(urlB) if err != nil { t.Fatalf("Failed to create connection for nc2: %v\n", err) } defer nc2.Close() ec2, _ := nats.NewEncodedConn(nc2, nats.JSON_ENCODER) response := []byte("I will help you") // Connect responder to srvA nc1.Subscribe("foo-req", func(m *nats.Msg) { nc1.Publish(m.Reply, response) }) // Make sure the route and the subscription are propogated. nc1.Flush() var resp string for i := 0; i < 100; i++ { if err := ec2.Request("foo-req", i, &resp, 100*time.Millisecond); err != nil { t.Fatalf("Received an error on Request test [%d]: %s", i, err) } } }
explode_data.jsonl/53510
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 444 }
[ 2830, 3393, 35295, 91931, 26653, 1155, 353, 8840, 836, 8, 341, 1903, 10553, 32, 11, 43578, 33, 11, 12185, 32, 11, 12185, 33, 1669, 1598, 78139, 1155, 340, 16867, 43578, 32, 10849, 18452, 741, 16867, 43578, 33, 10849, 18452, 2822, 19320,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestRequestAbsPathPreservesTrailingSlash(t *testing.T) { r := (&Request{baseURL: &url.URL{}}).AbsPath("/foo/") if s := r.URL().String(); s != "/foo/" { t.Errorf("trailing slash should be preserved: %s", s) } r = (&Request{baseURL: &url.URL{}}).AbsPath("/foo/") if s := r.URL().String(); s != "/foo/" { t.Errorf("trailing slash should be preserved: %s", s) } }
explode_data.jsonl/13249
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 149 }
[ 2830, 3393, 1900, 27778, 1820, 14367, 13280, 1282, 14277, 88004, 1155, 353, 8840, 836, 8, 341, 7000, 1669, 15899, 1900, 90, 3152, 3144, 25, 609, 1085, 20893, 90, 3417, 568, 27778, 1820, 4283, 7975, 53006, 743, 274, 1669, 435, 20893, 100...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func Test_GetLogsFromFailedContainer(t *testing.T) { ctx := context.Background() req := ContainerRequest{ Image: "alpine", Cmd: []string{"echo", "-n", "I was not expecting this"}, WaitingFor: wait.ForLog("I was expecting this").WithStartupTimeout(5 * time.Second), } c, err := GenericContainer(ctx, GenericContainerRequest{ ContainerRequest: req, Started: true, }) if err != nil && err.Error() != "failed to start container: context deadline exceeded" { t.Fatal(err) } else if err == nil { c.Terminate(ctx) t.Fatal("was expecting error starting container") } logs, logErr := c.Logs(ctx) if logErr != nil { t.Fatal(logErr) } b, err := ioutil.ReadAll(logs) if err != nil { t.Fatal(err) } log := string(b) if strings.Contains(log, "I was not expecting this") == false { t.Fatalf("could not find expected log in %s", log) } }
explode_data.jsonl/485
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 345 }
[ 2830, 3393, 13614, 51053, 3830, 9408, 4502, 1155, 353, 8840, 836, 8, 341, 20985, 1669, 2266, 19047, 741, 24395, 1669, 9678, 1900, 515, 197, 53397, 25, 414, 330, 278, 38038, 756, 197, 6258, 2277, 25, 286, 3056, 917, 4913, 3047, 497, 65...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
7
func TestHandlesDuplicatedSCTFeedback(t *testing.T) { s := createAndOpenStorage() defer closeAndDeleteStorage(s) v := mustCreateSignatureVerifiers(t) h := newHandlerWithClock(s, v, testStuckClock(stuckClockTimeMillis)) rr := httptest.NewRecorder() req, err := http.NewRequest("POST", "/.well-known/ct/v1/sct-feedback", strings.NewReader(addSCTFeedbackJSON)) if err != nil { t.Fatalf("Failed to create request: %v", err) } for i := 0; i < 10; i++ { h.HandleSCTFeedback(rr, req) assert.Equal(t, http.StatusOK, rr.Code) } numExpectedChains := 0 numExpectedSCTs := 0 f := sctFeedbackFromString(t, addSCTFeedbackJSON) for _, entry := range f.Feedback { numExpectedChains++ for _, sct := range entry.SCTData { numExpectedSCTs++ expectStorageHasFeedback(t, s, entry.X509Chain, sct) } } assert.EqualValues(t, numExpectedChains, mustGet(t, s.getNumChains)) assert.EqualValues(t, numExpectedSCTs, mustGet(t, s.getNumSCTs)) assert.EqualValues(t, numExpectedSCTs, mustGet(t, s.getNumFeedback)) // one feedback entry per SCT/Chain pair }
explode_data.jsonl/80081
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 430 }
[ 2830, 3393, 65928, 35, 98984, 50, 1162, 35348, 1155, 353, 8840, 836, 8, 341, 1903, 1669, 1855, 3036, 5002, 5793, 741, 16867, 3265, 3036, 6435, 5793, 1141, 340, 5195, 1669, 1969, 4021, 25088, 10141, 11836, 1155, 340, 9598, 1669, 501, 305...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
5
func TestTrackExportedFile(t *testing.T) { expected := `Start function: gotrack.TestTrackExportedFile End function: gotrack.TestTrackExportedFile took 2.0114ms ` path := "./output/test.txt" if _, err := os.Stat(path); os.IsExist(err) { if err := os.Remove(path); err != nil { t.Error(err) } } track, err := New(Config{ Debug: true, AsynLog: false, // Note ./ stands for the directory where the current file places ExportedPath: path, }) if err != nil { t.Error("error=", track.Error) } track.Start() track.End() f, err := os.Open(path) if err != nil { t.Error(err) } var actual = make([]byte, 1024) _, err = f.Read(actual) if err != nil { t.Error(err) } if !strings.Contains(string(actual), "Start function: gotrack.TestTrackExportedFile") { t.Errorf("actual:%s\nexpected:%s\n", actual, expected) } if !strings.Contains(string(actual), "End function: gotrack.TestTrackExportedFile") { t.Errorf("actual:%s\nexpected:%s\n", actual, expected) } }
explode_data.jsonl/40905
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 396 }
[ 2830, 3393, 15667, 16894, 291, 1703, 1155, 353, 8840, 836, 8, 341, 42400, 1669, 1565, 3479, 729, 25, 3174, 354, 71685, 8787, 15667, 16894, 291, 1703, 715, 3727, 729, 25, 3174, 354, 71685, 8787, 15667, 16894, 291, 1703, 3867, 220, 17, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
8
func TestValidate(t *testing.T) { kind := TokenKind{ Algo: TokenAlgoHmacSHA256, Expiration: 30 * time.Minute, SecretKey: "secret_key_name", Version: 1, } Convey("Works", t, func() { ctx := testContext() token, err := kind.Generate(ctx, []byte("state"), map[string]string{ "key1": "value1", "key2": "value2", }, 0) So(err, ShouldBeNil) // Good state. embedded, err := kind.Validate(ctx, token, []byte("state")) So(err, ShouldBeNil) So(embedded, ShouldResemble, map[string]string{ "key1": "value1", "key2": "value2", }) // Bad state. embedded, err = kind.Validate(ctx, token, []byte("???")) So(err, ShouldErrLike, "bad token MAC") // Not base64. embedded, err = kind.Validate(ctx, "?"+token[1:], []byte("state")) So(err, ShouldErrLike, "illegal base64 data") // Corrupted. embedded, err = kind.Validate(ctx, "X"+token[1:], []byte("state")) So(err, ShouldErrLike, "bad token MAC") // Too short. embedded, err = kind.Validate(ctx, token[:10], []byte("state")) So(err, ShouldErrLike, "too small") // Make it expired by rolling time forward. tc := clock.Get(ctx).(testclock.TestClock) tc.Add(31 * time.Minute) embedded, err = kind.Validate(ctx, token, []byte("state")) So(err, ShouldErrLike, "token expired") }) Convey("Custom expiration time", t, func() { ctx := testContext() token, err := kind.Generate(ctx, nil, nil, time.Minute) So(err, ShouldBeNil) // Valid. _, err = kind.Validate(ctx, token, nil) So(err, ShouldBeNil) // No longer valid. tc := clock.Get(ctx).(testclock.TestClock) tc.Add(2 * time.Minute) _, err = kind.Validate(ctx, token, nil) So(err, ShouldErrLike, "token expired") }) Convey("Unknown algo", t, func() { ctx := testContext() k2 := kind k2.Algo = "unknown" _, err := k2.Validate(ctx, "token", nil) So(err, ShouldErrLike, "unknown algo") }) Convey("Padding", t, func() { // Produce tokens of various length to ensure base64 padding stripping // works. ctx := testContext() for i := 0; i < 10; i++ { data := map[string]string{ "k": strings.Repeat("a", i), } token, err := kind.Generate(ctx, nil, data, 0) So(err, ShouldBeNil) extracted, err := kind.Validate(ctx, token, nil) So(err, ShouldBeNil) So(extracted, ShouldResemble, data) } }) }
explode_data.jsonl/36818
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 975 }
[ 2830, 3393, 17926, 1155, 353, 8840, 836, 8, 341, 197, 15314, 1669, 9660, 10629, 515, 197, 197, 2101, 3346, 25, 981, 9660, 2101, 3346, 39, 11948, 33145, 17, 20, 21, 345, 197, 197, 66301, 25, 220, 18, 15, 353, 882, 75770, 345, 197, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestRepositoryURI(t *testing.T) { mockError := errors.New("error") mockRepoName := "mockRepoName" mockRepoURI := "mockRepoURI" testCases := map[string]struct { mockECRClient func(m *mocks.Mockapi) wantURI string wantErr error }{ "should return wrapped error given error returned from DescribeRepositories": { mockECRClient: func(m *mocks.Mockapi) { m.EXPECT().DescribeRepositories(gomock.Any()).Return(nil, mockError) }, wantErr: fmt.Errorf("ecr describe repository %s: %w", mockRepoName, mockError), }, "should return error given no repositories returned in list": { mockECRClient: func(m *mocks.Mockapi) { m.EXPECT().DescribeRepositories(&ecr.DescribeRepositoriesInput{ RepositoryNames: aws.StringSlice([]string{mockRepoName}), }).Return(&ecr.DescribeRepositoriesOutput{ Repositories: []*ecr.Repository{}, }, nil) }, wantErr: errors.New("no repositories found"), }, "should return repository URI": { mockECRClient: func(m *mocks.Mockapi) { m.EXPECT().DescribeRepositories(&ecr.DescribeRepositoriesInput{ RepositoryNames: aws.StringSlice([]string{mockRepoName}), }).Return(&ecr.DescribeRepositoriesOutput{ Repositories: []*ecr.Repository{ &ecr.Repository{ RepositoryUri: aws.String(mockRepoURI), }, }, }, nil) }, wantURI: mockRepoURI, }, } for name, tc := range testCases { t.Run(name, func(t *testing.T) { // GIVEN ctrl := gomock.NewController(t) defer ctrl.Finish() mockECRAPI := mocks.NewMockapi(ctrl) tc.mockECRClient(mockECRAPI) client := ECR{ mockECRAPI, } gotURI, gotErr := client.RepositoryURI(mockRepoName) require.Equal(t, tc.wantURI, gotURI) require.Equal(t, tc.wantErr, gotErr) }) } }
explode_data.jsonl/31312
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 769 }
[ 2830, 3393, 4624, 10301, 1155, 353, 8840, 836, 8, 341, 77333, 1454, 1669, 5975, 7121, 445, 841, 5130, 77333, 25243, 675, 1669, 330, 16712, 25243, 675, 698, 77333, 25243, 10301, 1669, 330, 16712, 25243, 10301, 1837, 18185, 37302, 1669, 241...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestBadProtocol(t *testing.T) { dialer := NewDialer(Config{ DialServer: func() (net.Conn, error) { return net.Dial("tcp", "www.google.com") }, }) _, err := dialer.Dial("udp", "www.google.com") assert.Error(t, err, "Dialing with a non-tcp protocol should have failed") }
explode_data.jsonl/15723
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 113 }
[ 2830, 3393, 17082, 20689, 1155, 353, 8840, 836, 8, 341, 2698, 530, 261, 1669, 1532, 35, 530, 261, 33687, 515, 197, 10957, 530, 5475, 25, 2915, 368, 320, 4711, 50422, 11, 1465, 8, 341, 298, 853, 4179, 98462, 445, 27161, 497, 330, 213...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestYearRetention(t *testing.T) { secs, err := RetentionSeconds("1y") if err != nil { t.Errorf("Unable to calculate retention") } if secs != uint32(60*60*24*365) { t.Errorf("Incorrect retention") } }
explode_data.jsonl/74562
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 87 }
[ 2830, 3393, 9490, 86329, 1155, 353, 8840, 836, 8, 341, 197, 53281, 11, 1848, 1669, 10392, 2939, 15343, 445, 16, 88, 1138, 743, 1848, 961, 2092, 341, 197, 3244, 13080, 445, 17075, 311, 11047, 37131, 1138, 197, 630, 743, 49749, 961, 262...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestValueSetUnmarshalJSON(t *testing.T) { set1 := NewValueSet( NewBoolValue(true), NewStringValue("false"), NewIntValue(7), NewStringValue("7"), NewStringValue("foo"), NewStringValue("192.168.1.100/24"), ) testCases := []struct { data []byte expectedResult ValueSet expectErr bool }{ {[]byte(`true`), NewValueSet(NewBoolValue(true)), false}, {[]byte(`7`), NewValueSet(NewIntValue(7)), false}, {[]byte(`"foo"`), NewValueSet(NewStringValue("foo")), false}, {[]byte(`[true]`), NewValueSet(NewBoolValue(true)), false}, {[]byte(`[7]`), NewValueSet(NewIntValue(7)), false}, {[]byte(`["foo"]`), NewValueSet(NewStringValue("foo")), false}, {[]byte(`[true, "false", 7, "7", "foo", "192.168.1.100/24"]`), set1, false}, {[]byte(`{}`), nil, true}, // Unsupported data. {[]byte(`[]`), nil, true}, // Empty array. {[]byte(`[7, 7, true]`), nil, true}, // Duplicate value. } for i, testCase := range testCases { result := make(ValueSet) err := json.Unmarshal(testCase.data, &result) expectErr := (err != nil) if expectErr != testCase.expectErr { t.Fatalf("case %v: error: expected: %v, got: %v\n", i+1, testCase.expectErr, expectErr) } if !testCase.expectErr { if !reflect.DeepEqual(result, testCase.expectedResult) { t.Fatalf("case %v: result: expected: %v, got: %v\n", i+1, testCase.expectedResult, result) } } } }
explode_data.jsonl/5958
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 626 }
[ 2830, 3393, 1130, 1649, 1806, 27121, 5370, 1155, 353, 8840, 836, 8, 341, 8196, 16, 1669, 1532, 1130, 1649, 1006, 197, 197, 3564, 11233, 1130, 3715, 1326, 197, 197, 3564, 82696, 445, 3849, 4461, 197, 197, 3564, 1072, 1130, 7, 22, 1326,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
5
func TestNamed(t *testing.T) { type Aaa struct{} type Bbb struct { Aaa *Aaa `inject:"aaa"` } b := new(Bbb) di := New(). WithNamedObject("aaa", new(Aaa)). WithObject(b). InitializeGraph() assert.NotNil(t, b.Aaa) aaaObj := di.MustGetNamedObject(&Aaa{}, "aaa") assert.NotNil(t, aaaObj) bbbObj := di.MustGetObject(&Bbb{}) assert.NotNil(t, bbbObj) }
explode_data.jsonl/72958
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 171 }
[ 2830, 3393, 15810, 1155, 353, 8840, 836, 8, 341, 13158, 362, 5305, 2036, 16094, 13158, 425, 6066, 2036, 341, 197, 22985, 5305, 353, 32, 5305, 1565, 32133, 2974, 32646, 8805, 197, 630, 2233, 1669, 501, 5349, 6066, 692, 2698, 72, 1669, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestLachesisClassicRoots(t *testing.T) { testSpecialNamedRoots(t, ` A1.01 B1.01 C1.01 D1.01 // 1 ║ ║ ║ ║ ║ ╠──────╫───── d1.02 ║ ║ ║ ║ ║ b1.02 ─╫──────╣ ║ ║ ║ ║ ║ ╠──────╫───── d1.03 a1.02 ─╣ ║ ║ ║ ║ ║ ║ ║ b1.03 ─╣ ║ ║ ║ ║ ║ ║ ╠──────╫───── d1.04 ║ ║ ║ ║ ║ ╠───── c1.02 ║ ║ ║ ║ ║ ║ b1.04 ─╫──────╣ ║ ║ ║ ║ // 2 ╠──────╫──────╫───── D2.05 ║ ║ ║ ║ A2.03 ─╫──────╫──────╣ ║ ║ ║ ║ a2.04 ─╫──────╣ ║ ║ ║ ║ ║ ║ B2.05 ─╫──────╣ ║ ║ ║ ║ ║ ╠──────╫───── d2.06 a2.05 ─╣ ║ ║ ║ ║ ║ ║ ╠──────╫───── C2.03 ║ ║ ║ ║ ║ ╠──────╫──────╫───── d2.07 ║ ║ ║ ║ ╠───── b2.06 ║ ║ ║ ║ ║ ║ // 3 ║ B3.07 ─╫──────╣ ║ ║ ║ ║ A3.06 ─╣ ║ ║ ║ ╠──────╫───── D3.08 ║ ║ ║ ║ ║ ║ ╠───── d309 ╠───── b3.08 ║ ║ ║ ║ ║ ║ ╠───── b3.09 ║ ║ ║ ║ C3.04 ─╣ a3.07 ─╣ ║ ║ ║ ║ ║ ║ ║ b3.10 ─╫──────╣ ║ ║ ║ ║ a3.08 ─╣ ║ ║ ║ ╠──────╫───── d3.10 ║ ║ ║ ║ ╠───── b3.11 ║ ║ // 4 ║ ║ ╠───── D4.11 ║ ║ ║ ║ ║ B4.12 ─╫──────╣ ║ ║ ║ ║ `) }
explode_data.jsonl/15484
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1383 }
[ 2830, 3393, 43, 610, 13774, 63331, 8439, 82, 1155, 353, 8840, 836, 8, 341, 18185, 20366, 15810, 8439, 82, 1155, 11, 22074, 32, 16, 13, 15, 16, 220, 425, 16, 13, 15, 16, 220, 356, 16, 13, 15, 16, 220, 422, 16, 13, 15, 16, 220, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestRefreshLock(t *testing.T) { ctx := context.Background() conn, err := grpc.DialContext(ctx, "bufnet", grpc.WithContextDialer(bufDialer), grpc.WithInsecure()) if err != nil { t.Fatalf("Failed to dial bufnet: %v", err) } defer conn.Close() defer rl.Unlock(testResourceID, testLockID) // set lock rl.Lock(testResourceID, testLockID, testTTL) client := pb.NewLockClient(conn) res, err := client.RefreshLock(ctx, &pb.LockRequest{ResourceId: testResourceID, LockId: testLockID, Ttl: testTTL}) if err != nil { t.Fatalf("GetLock failed: %v", err) } assert.Equal(t, res.Status, pb.ResponseStatus_OK) assert.Equal(t, res.LockId, testLockID) assert.Equal(t, res.ResourceId, testResourceID) assert.LessOrEqual(t, int(res.Ttl), testTTL) }
explode_data.jsonl/82343
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 299 }
[ 2830, 3393, 14567, 11989, 1155, 353, 8840, 836, 8, 341, 20985, 1669, 2266, 19047, 741, 32917, 11, 1848, 1669, 47900, 98462, 1972, 7502, 11, 330, 5909, 4711, 497, 47900, 26124, 1972, 35, 530, 261, 10731, 35, 530, 261, 701, 47900, 26124, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestLevelToString(t *testing.T) { tests := []struct { level Level wantOut string }{ {level: DEBUG, wantOut: "DEBUG"}, {level: INFO, wantOut: "INFO"}, {level: WARN, wantOut: "WARN"}, {level: ERROR, wantOut: "ERROR"}, {level: PANIC, wantOut: "PANIC"}, {level: FATAL, wantOut: "FATAL"}, {level: OFF, wantOut: "OFF"}, } for _, tt := range tests { got := tt.level.String() if got != tt.wantOut { t.Errorf("%v.String() output = %v, want %v", tt.level, got, tt.wantOut) } gotColor := tt.level.ColorString() if !strings.Contains(gotColor, tt.wantOut) { t.Errorf("%v.ColorString() output = %v, want %v", tt.level, gotColor, tt.wantOut) } } }
explode_data.jsonl/75477
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 299 }
[ 2830, 3393, 4449, 5870, 1155, 353, 8840, 836, 8, 341, 78216, 1669, 3056, 1235, 341, 197, 53743, 256, 9395, 198, 197, 50780, 2662, 914, 198, 197, 59403, 197, 197, 90, 3294, 25, 12657, 11, 1366, 2662, 25, 330, 5150, 7115, 197, 197, 90...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
4
func TestResolveInMainDict(t *testing.T) { cxt := context.NewTestContext(t) cxt.AddTestFile("testdata/param-test-in-block.yaml", config.Name) m, err := LoadManifestFrom(cxt.Context, config.Name) require.NoError(t, err, "could not load manifest") rm := NewRuntimeManifest(cxt.Context, ActionInstall, m) installStep := rm.Install[0] os.Setenv("COMMAND", "echo hello world") err = rm.ResolveStep(installStep) assert.NoError(t, err) assert.NotNil(t, installStep.Data) t.Logf("install data %v", installStep.Data) exec := installStep.Data["exec"].(map[interface{}]interface{}) assert.NotNil(t, exec) command := exec["command"].(interface{}) assert.NotNil(t, command) cmdVal, ok := command.(string) assert.True(t, ok) assert.Equal(t, "echo hello world", cmdVal) }
explode_data.jsonl/37716
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 294 }
[ 2830, 3393, 56808, 641, 6202, 13448, 1155, 353, 8840, 836, 8, 341, 1444, 2252, 1669, 2266, 7121, 2271, 1972, 1155, 692, 1444, 2252, 1904, 2271, 1703, 445, 92425, 14, 903, 16839, 3419, 9425, 33406, 497, 2193, 2967, 692, 2109, 11, 1848, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestServiceImageName(t *testing.T) { assert.Equal(t, getImageName(types.ServiceConfig{Image: "myImage"}, "myProject"), "myImage") assert.Equal(t, getImageName(types.ServiceConfig{Name: "aService"}, "myProject"), "myProject_aService") }
explode_data.jsonl/72626
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 82 }
[ 2830, 3393, 1860, 1906, 675, 1155, 353, 8840, 836, 8, 341, 6948, 12808, 1155, 11, 54561, 675, 52613, 13860, 2648, 90, 1906, 25, 330, 2408, 1906, 14345, 330, 2408, 7849, 3975, 330, 2408, 1906, 1138, 6948, 12808, 1155, 11, 54561, 675, 5...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
1
func TestFailedValuer(t *testing.T) { name := randName() err := DB.Exec("INSERT INTO users(name, password) VALUES(?, ?)", name, EncryptedData("xpass1")).Error if err == nil { t.Errorf("There should be an error should happen when insert data") } else if !strings.HasPrefix(err.Error(), "Should not start with") { t.Errorf("The error should be returned from Valuer, but get %v", err) } }
explode_data.jsonl/34902
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 134 }
[ 2830, 3393, 9408, 2208, 8801, 1155, 353, 8840, 836, 8, 341, 11609, 1669, 10382, 675, 2822, 9859, 1669, 5952, 30798, 445, 12698, 12496, 3847, 3153, 11, 3552, 8, 14710, 7, 12622, 937, 11583, 829, 11, 10751, 14026, 1043, 445, 87, 6385, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestOutputLog(t *testing.T) { t.Run("All Output", func(t *testing.T) { l := NewLogger(Debug) buf := &bytes.Buffer{} l.SetLogger(log.New(os.Stderr, "", log.Lmsgprefix)) l.SetOutput(buf) l.Debug("Test Debug %s", "hoge") l.Info("Test Info %s", "hoge") l.Warn("Test Warn %s", "hoge") l.Error("Test Error %s", "hoge") wants := []string{ "[DEBUG] Test Debug hoge\n", "[INFO ] Test Info hoge\n", "[WARN ] Test Warn hoge\n", "[ERROR] Test Error hoge\n", } for _, want := range wants { got, err := buf.ReadString('\n') if err != nil { t.Errorf("Can't be got actual value. %s\n", err) } if strings.Compare(want, got) != 0 { t.Errorf("Did not match value. want=%s, got=%s\n", want, got) } } }) t.Run("Level extract by Info", func(t *testing.T) { l := NewLogger(Info) buf := &bytes.Buffer{} l.SetLogger(log.New(os.Stderr, "", log.Lmsgprefix)) l.SetOutput(buf) l.Debug("Test Debug %s", "hoge") l.Info("Test Info %s", "hoge") l.Warn("Test Warn %s", "hoge") l.Error("Test Error %s", "hoge") wants := []string{ "[INFO ] Test Info hoge\n", "[WARN ] Test Warn hoge\n", "[ERROR] Test Error hoge\n", } for _, want := range wants { got, err := buf.ReadString('\n') if err != nil { t.Errorf("Can't be got actual value. %s\n", err) } if strings.Compare(want, got) != 0 { t.Errorf("Did not match value. want=%s, got=%s\n", want, got) } } }) t.Run("Level extract by warn", func(t *testing.T) { l := NewLogger(Warn) buf := &bytes.Buffer{} l.SetLogger(log.New(os.Stderr, "", log.Lmsgprefix)) l.SetOutput(buf) l.Debug("Test Debug %s", "hoge") l.Info("Test Info %s", "hoge") l.Warn("Test Warn %s", "hoge") l.Error("Test Error %s", "hoge") wants := []string{ "[WARN ] Test Warn hoge\n", "[ERROR] Test Error hoge\n", } for _, want := range wants { got, err := buf.ReadString('\n') if err != nil { t.Errorf("Can't be got actual value. %s\n", err) } if strings.Compare(want, got) != 0 { t.Errorf("Did not match value. want=%s, got=%s\n", want, got) } } }) t.Run("Level extract by error", func(t *testing.T) { l := NewLogger(Error) buf := &bytes.Buffer{} l.SetLogger(log.New(os.Stderr, "", log.Lmsgprefix)) l.SetOutput(buf) l.Debug("Test Debug %s", "hoge") l.Info("Test Info %s", "hoge") l.Warn("Test Warn %s", "hoge") l.Error("Test Error %s", "hoge") wants := []string{ "[ERROR] Test Error hoge\n", } for _, want := range wants { got, err := buf.ReadString('\n') if err != nil { t.Errorf("Can't be got actual value. %s\n", err) } if strings.Compare(want, got) != 0 { t.Errorf("Did not match value. want=%s, got=%s\n", want, got) } } }) t.Run("output uuid", func(t *testing.T) { uuid := "12345" ctx := context.WithValue(context.Background(), UUIDContextKey, uuid) l := NewLogger(Debug) buf := &bytes.Buffer{} l.SetLogger(log.New(os.Stderr, "", log.Lmsgprefix)) l.SetOutput(buf) l.WithUUID(ctx).Debug("Test Debug %s", "hoge") l.WithUUID(ctx).Info("Test Info %s", "hoge") cl := l.WithUUID(ctx) cl.Warn("Test Warn %s", "hoge") cl.Error("Test Error %s", "hoge") wants := []string{ uuid + " [DEBUG] Test Debug hoge\n", uuid + " [INFO ] Test Info hoge\n", uuid + " [WARN ] Test Warn hoge\n", uuid + " [ERROR] Test Error hoge\n", } for _, want := range wants { got, err := buf.ReadString('\n') if err != nil { t.Errorf("Can't be got actual value. %s\n", err) } if strings.Compare(want, got) != 0 { t.Errorf("Did not match value. want=%s, got=%s\n", want, got) } } }) }
explode_data.jsonl/60890
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1686 }
[ 2830, 3393, 5097, 2201, 1155, 353, 8840, 836, 8, 341, 3244, 16708, 445, 2403, 9258, 497, 2915, 1155, 353, 8840, 836, 8, 341, 197, 8810, 1669, 1532, 7395, 42618, 340, 197, 26398, 1669, 609, 9651, 22622, 16094, 197, 8810, 4202, 7395, 12...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
4
func TestApiTest_MatchesJSONBodyFromFile(t *testing.T) { handler := http.NewServeMux() handler.HandleFunc("/hello", func(w http.ResponseWriter, r *http.Request) { data, _ := ioutil.ReadAll(r.Body) assert.JSONEq(t, `{"a": 12345}`, string(data)) w.WriteHeader(http.StatusCreated) w.Header().Set("Content-Type", "application/json") _, err := w.Write([]byte(`{"a": 12345}`)) if err != nil { panic(err) } }) apitest.New(). Handler(handler). Post("/hello"). JSONFromFile("testdata/request_body.json"). Expect(t). BodyFromFile("testdata/response_body.json"). Status(http.StatusCreated). End() }
explode_data.jsonl/54799
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 256 }
[ 2830, 3393, 6563, 2271, 1245, 9118, 5370, 5444, 43633, 1155, 353, 8840, 836, 8, 341, 53326, 1669, 1758, 7121, 60421, 44, 2200, 741, 53326, 63623, 4283, 14990, 497, 2915, 3622, 1758, 37508, 11, 435, 353, 1254, 9659, 8, 341, 197, 8924, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestCT_WebPublishingMarshalUnmarshal(t *testing.T) { v := sml.NewCT_WebPublishing() buf, _ := xml.Marshal(v) v2 := sml.NewCT_WebPublishing() xml.Unmarshal(buf, v2) }
explode_data.jsonl/67904
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 79 }
[ 2830, 3393, 1162, 62, 5981, 50145, 287, 55438, 1806, 27121, 1155, 353, 8840, 836, 8, 341, 5195, 1669, 274, 1014, 7121, 1162, 62, 5981, 50145, 287, 741, 26398, 11, 716, 1669, 8396, 37271, 3747, 340, 5195, 17, 1669, 274, 1014, 7121, 116...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
1
func TestNamespacesGenerator_Event(t *testing.T) { controller := gomock.NewController(t) defer controller.Finish() namespaceClient := fake.NewMockNamespaceInterface(controller) namespaceClient.EXPECT(). Names(). Return([]string{"ns1", "ns2"}, nil) g := NamespacesGenerator{ NamespaceClient: namespaceClient, } ctx := context.Background() event, err := g.Event(ctx) require.NoError(t, err) expectedResponse := namespacesResponse{ Namespaces: []string{"ns1", "ns2"}, } expectedData, err := json.Marshal(&expectedResponse) require.NoError(t, err) assert.Equal(t, octant.EventTypeNamespaces, event.Type) assert.Equal(t, expectedData, event.Data) }
explode_data.jsonl/47701
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 231 }
[ 2830, 3393, 7980, 27338, 12561, 39354, 1155, 353, 8840, 836, 8, 341, 61615, 1669, 342, 316, 1176, 7121, 2051, 1155, 340, 16867, 6461, 991, 18176, 2822, 56623, 2959, 1669, 12418, 7121, 11571, 22699, 5051, 40845, 692, 56623, 2959, 22402, 72...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestNumCPUCheck(t *testing.T) { var tests = []struct { numCPU int numErrors int numWarnings int }{ {0, 0, 0}, {999999999, 1, 0}, } for _, rt := range tests { t.Run(fmt.Sprintf("number of CPUs: %d", rt.numCPU), func(t *testing.T) { warnings, errors := NumCPUCheck{NumCPU: rt.numCPU}.Check() if len(warnings) != rt.numWarnings { t.Errorf("expected %d warning(s) but got %d: %q", rt.numWarnings, len(warnings), warnings) } if len(errors) != rt.numErrors { t.Errorf("expected %d warning(s) but got %d: %q", rt.numErrors, len(errors), errors) } }) } }
explode_data.jsonl/56073
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 280 }
[ 2830, 3393, 4651, 31615, 3973, 1155, 353, 8840, 836, 8, 341, 2405, 7032, 284, 3056, 1235, 341, 197, 22431, 31615, 414, 526, 198, 197, 22431, 13877, 256, 526, 198, 197, 22431, 20140, 526, 198, 197, 59403, 197, 197, 90, 15, 11, 220, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestSAAsOAuthClient(t *testing.T) { testutil.RequireEtcd(t) _, clusterAdminKubeConfig, err := testserver.StartTestMaster() if err != nil { t.Fatalf("unexpected error: %v", err) } authorizationCodes := make(chan string, 1) authorizationErrors := make(chan string, 1) oauthServer := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) { t.Logf("fake pod server got %v", req.URL) if code := req.URL.Query().Get("code"); len(code) > 0 { authorizationCodes <- code } if err := req.URL.Query().Get("error"); len(err) > 0 { authorizationErrors <- err } })) defer oauthServer.Close() clusterAdminClient, err := testutil.GetClusterAdminClient(clusterAdminKubeConfig) if err != nil { t.Fatalf("unexpected error: %v", err) } clusterAdminKubeClient, err := testutil.GetClusterAdminKubeClient(clusterAdminKubeConfig) if err != nil { t.Fatalf("unexpected error: %v", err) } clusterAdminClientConfig, err := testutil.GetClusterAdminClientConfig(clusterAdminKubeConfig) if err != nil { t.Fatalf("unexpected error: %v", err) } projectName := "hammer-project" if _, err := testserver.CreateNewProject(clusterAdminClient, *clusterAdminClientConfig, projectName, "harold"); err != nil { t.Fatalf("unexpected error: %v", err) } if err := testserver.WaitForServiceAccounts(clusterAdminKubeClient, projectName, []string{"default"}); err != nil { t.Fatalf("unexpected error: %v", err) } // get the SA ready with redirect URIs and secret annotations defaultSA, err := clusterAdminKubeClient.ServiceAccounts(projectName).Get("default") if err != nil { t.Fatalf("unexpected error: %v", err) } // retry this a couple times. We seem to be flaking on update conflicts and missing secrets all together err = wait.PollImmediate(30*time.Millisecond, 10*time.Second, func() (done bool, err error) { if defaultSA.Annotations == nil { defaultSA.Annotations = map[string]string{} } defaultSA.Annotations[saoauth.OAuthRedirectURISecretAnnotationPrefix+"one"] = oauthServer.URL defaultSA.Annotations[saoauth.OAuthWantChallengesAnnotationPrefix] = "true" defaultSA, err = clusterAdminKubeClient.ServiceAccounts(projectName).Update(defaultSA) if err != nil { t.Logf("unexpected err: %v", err) return false, nil } return true, nil }) if err != nil { t.Fatalf("unexpected error: %v", err) } var oauthSecret *kapi.Secret // retry this a couple times. We seem to be flaking on update conflicts and missing secrets all together err = wait.PollImmediate(30*time.Millisecond, 10*time.Second, func() (done bool, err error) { allSecrets, err := clusterAdminKubeClient.Secrets(projectName).List(kapi.ListOptions{}) if err != nil { return false, err } for i := range allSecrets.Items { secret := allSecrets.Items[i] if serviceaccount.IsServiceAccountToken(&secret, defaultSA) { oauthSecret = &secret return true, nil } } return false, nil }) if err != nil { t.Fatalf("unexpected error: %v", err) } oauthClientConfig := &osincli.ClientConfig{ ClientId: serviceaccount.MakeUsername(defaultSA.Namespace, defaultSA.Name), ClientSecret: string(oauthSecret.Data[kapi.ServiceAccountTokenKey]), AuthorizeUrl: clusterAdminClientConfig.Host + "/oauth/authorize", TokenUrl: clusterAdminClientConfig.Host + "/oauth/token", RedirectUrl: oauthServer.URL, Scope: scope.Join([]string{"user:info", "role:edit:" + projectName}), SendClientSecretInParams: true, } runOAuthFlow(t, clusterAdminClientConfig, projectName, oauthClientConfig, authorizationCodes, authorizationErrors, true, true) clusterAdminClient.OAuthClientAuthorizations().Delete("harold:" + oauthClientConfig.ClientId) oauthClientConfig = &osincli.ClientConfig{ ClientId: serviceaccount.MakeUsername(defaultSA.Namespace, defaultSA.Name), ClientSecret: string(oauthSecret.Data[kapi.ServiceAccountTokenKey]), AuthorizeUrl: clusterAdminClientConfig.Host + "/oauth/authorize", TokenUrl: clusterAdminClientConfig.Host + "/oauth/token", RedirectUrl: oauthServer.URL, Scope: scope.Join([]string{"user:info", "role:edit:other-ns"}), SendClientSecretInParams: true, } runOAuthFlow(t, clusterAdminClientConfig, projectName, oauthClientConfig, authorizationCodes, authorizationErrors, false, false) clusterAdminClient.OAuthClientAuthorizations().Delete("harold:" + oauthClientConfig.ClientId) oauthClientConfig = &osincli.ClientConfig{ ClientId: serviceaccount.MakeUsername(defaultSA.Namespace, defaultSA.Name), ClientSecret: string(oauthSecret.Data[kapi.ServiceAccountTokenKey]), AuthorizeUrl: clusterAdminClientConfig.Host + "/oauth/authorize", TokenUrl: clusterAdminClientConfig.Host + "/oauth/token", RedirectUrl: oauthServer.URL, Scope: scope.Join([]string{"user:info"}), SendClientSecretInParams: true, } runOAuthFlow(t, clusterAdminClientConfig, projectName, oauthClientConfig, authorizationCodes, authorizationErrors, true, false) clusterAdminClient.OAuthClientAuthorizations().Delete("harold:" + oauthClientConfig.ClientId) }
explode_data.jsonl/20544
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1767 }
[ 2830, 3393, 7778, 2121, 57850, 2959, 1155, 353, 8840, 836, 8, 341, 18185, 1314, 81288, 31860, 4385, 1155, 340, 197, 6878, 10652, 7210, 42, 3760, 2648, 11, 1848, 1669, 1273, 4030, 12101, 2271, 18041, 741, 743, 1848, 961, 2092, 341, 197, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestEverything(t *testing.T) { ResetForTesting(nil) Bool("test_bool", false, "bool value") Int("test_int", 0, "int value") Int64("test_int64", 0, "int64 value") Uint("test_uint", 0, "uint value") Uint64("test_uint64", 0, "uint64 value") String("test_string", "0", "string value") Float64("test_float64", 0, "float64 value") Duration("test_duration", 0, "time.Duration value") m := make(map[string]*Flag) desired := "0" visitor := func(f *Flag) { if len(f.Name) > 5 && f.Name[0:5] == "test_" { m[f.Name] = f ok := false switch { case f.Value.String() == desired: ok = true case f.Name == "test_bool" && f.Value.String() == boolString(desired): ok = true case f.Name == "test_duration" && f.Value.String() == desired+"s": ok = true } if !ok { t.Error("Visit: bad value", f.Value.String(), "for", f.Name) } } } VisitAll(visitor) if len(m) != 8 { t.Error("VisitAll misses some flags") for k, v := range m { t.Log(k, *v) } } m = make(map[string]*Flag) Visit(visitor) if len(m) != 0 { t.Errorf("Visit sees unset flags") for k, v := range m { t.Log(k, *v) } } // Now set all flags Set("test_bool", "true") Set("test_int", "1") Set("test_int64", "1") Set("test_uint", "1") Set("test_uint64", "1") Set("test_string", "1") Set("test_float64", "1") Set("test_duration", "1s") desired = "1" Visit(visitor) if len(m) != 8 { t.Error("Visit fails after set") for k, v := range m { t.Log(k, *v) } } // Now test they're visited in sort order. var flagNames []string Visit(func(f *Flag) { flagNames = append(flagNames, f.Name) }) if !sort.StringsAreSorted(flagNames) { t.Errorf("flag names not sorted: %v", flagNames) } }
explode_data.jsonl/53988
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 764 }
[ 2830, 3393, 34964, 1155, 353, 8840, 836, 8, 341, 197, 14828, 2461, 16451, 27907, 340, 197, 11233, 445, 1944, 22159, 497, 895, 11, 330, 2641, 897, 1138, 57152, 445, 1944, 4042, 497, 220, 15, 11, 330, 396, 897, 1138, 57152, 21, 19, 44...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
9
func Test_LRUCache(t *testing.T) { assert := assert.New(t) cache := LRUCacheConstructor(2) cache.Put(1, 1) cache.Put(2, 2) assert.Equal(1, cache.Get(1)) cache.Put(3, 3) // evicts key 2 assert.Equal(-1, cache.Get(2)) // returns -1 (not found) cache.Put(4, 4) // evicts key 1 assert.Equal(-1, cache.Get(1)) // returns -1 (not found) assert.Equal(3, cache.Get(3)) // returns 3 assert.Equal(4, cache.Get(4)) // returns 4 cache = LRUCacheConstructor(2) cache.Put(2, 1) cache.Put(1, 1) cache.Put(2, 3) cache.Put(4, 1) assert.Equal(-1, cache.Get(1)) assert.Equal(3, cache.Get(2)) }
explode_data.jsonl/52678
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 299 }
[ 2830, 3393, 94938, 5459, 1777, 1155, 353, 8840, 836, 8, 341, 6948, 1669, 2060, 7121, 1155, 692, 52680, 1669, 44550, 5459, 1777, 13288, 7, 17, 692, 52680, 39825, 7, 16, 11, 220, 16, 340, 52680, 39825, 7, 17, 11, 220, 17, 340, 6948, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestPostStoreGetFlaggedPostsForChannel(t *testing.T) { Setup() o1 := &model.Post{} o1.ChannelId = model.NewId() o1.UserId = model.NewId() o1.Message = "zz" + model.NewId() + "b" o1 = (<-store.Post().Save(o1)).Data.(*model.Post) time.Sleep(2 * time.Millisecond) o2 := &model.Post{} o2.ChannelId = o1.ChannelId o2.UserId = model.NewId() o2.Message = "zz" + model.NewId() + "b" o2 = (<-store.Post().Save(o2)).Data.(*model.Post) time.Sleep(2 * time.Millisecond) // deleted post o3 := &model.Post{} o3.ChannelId = model.NewId() o3.UserId = o1.ChannelId o3.Message = "zz" + model.NewId() + "b" o3.DeleteAt = 1 o3 = (<-store.Post().Save(o3)).Data.(*model.Post) time.Sleep(2 * time.Millisecond) o4 := &model.Post{} o4.ChannelId = model.NewId() o4.UserId = model.NewId() o4.Message = "zz" + model.NewId() + "b" o4 = (<-store.Post().Save(o4)).Data.(*model.Post) time.Sleep(2 * time.Millisecond) r := (<-store.Post().GetFlaggedPostsForChannel(o1.UserId, o1.ChannelId, 0, 10)).Data.(*model.PostList) if len(r.Order) != 0 { t.Fatal("should be empty") } preference := model.Preference{ UserId: o1.UserId, Category: model.PREFERENCE_CATEGORY_FLAGGED_POST, Name: o1.Id, Value: "true", } Must(store.Preference().Save(&model.Preferences{preference})) r = (<-store.Post().GetFlaggedPostsForChannel(o1.UserId, o1.ChannelId, 0, 10)).Data.(*model.PostList) if len(r.Order) != 1 { t.Fatal("should have 1 post") } preference.Name = o2.Id Must(store.Preference().Save(&model.Preferences{preference})) preference.Name = o3.Id Must(store.Preference().Save(&model.Preferences{preference})) r = (<-store.Post().GetFlaggedPostsForChannel(o1.UserId, o1.ChannelId, 0, 1)).Data.(*model.PostList) if len(r.Order) != 1 { t.Fatal("should have 1 post") } r = (<-store.Post().GetFlaggedPostsForChannel(o1.UserId, o1.ChannelId, 1, 1)).Data.(*model.PostList) if len(r.Order) != 1 { t.Fatal("should have 1 post") } r = (<-store.Post().GetFlaggedPostsForChannel(o1.UserId, o1.ChannelId, 1000, 10)).Data.(*model.PostList) if len(r.Order) != 0 { t.Fatal("should be empty") } r = (<-store.Post().GetFlaggedPostsForChannel(o1.UserId, o1.ChannelId, 0, 10)).Data.(*model.PostList) if len(r.Order) != 2 { t.Fatal("should have 2 posts") } preference.Name = o4.Id Must(store.Preference().Save(&model.Preferences{preference})) r = (<-store.Post().GetFlaggedPostsForChannel(o1.UserId, o4.ChannelId, 0, 10)).Data.(*model.PostList) if len(r.Order) != 1 { t.Fatal("should have 1 post") } }
explode_data.jsonl/55956
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1082 }
[ 2830, 3393, 4133, 6093, 1949, 12135, 3556, 19631, 2461, 9629, 1155, 353, 8840, 836, 8, 341, 197, 21821, 2822, 22229, 16, 1669, 609, 2528, 23442, 16094, 22229, 16, 38716, 764, 284, 1614, 7121, 764, 741, 22229, 16, 37478, 284, 1614, 7121,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
8
func TestPacman(t *testing.T) { L := newLuaState() defer L.Close() const code = ` tmux = resource.pacman.new("tmux") ` if err := L.DoString(code); err != nil { t.Fatal(err) } pkg := luaResource(L, "tmux").(*Pacman) errorIfNotEqual(t, "package", pkg.Type) errorIfNotEqual(t, "tmux", pkg.Name) errorIfNotEqual(t, "installed", pkg.State) errorIfNotEqual(t, []string{}, pkg.Require) errorIfNotEqual(t, []string{"present", "installed"}, pkg.PresentStatesList) errorIfNotEqual(t, []string{"absent", "deinstalled"}, pkg.AbsentStatesList) errorIfNotEqual(t, false, pkg.Concurrent) errorIfNotEqual(t, "tmux", pkg.Package) errorIfNotEqual(t, "", pkg.Version) }
explode_data.jsonl/40282
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 283 }
[ 2830, 3393, 47, 94114, 1155, 353, 8840, 836, 8, 341, 15070, 1669, 501, 58020, 1397, 741, 16867, 444, 10421, 2822, 4777, 2038, 284, 22074, 3244, 75066, 284, 5101, 556, 94114, 4618, 445, 13730, 2200, 1138, 197, 19324, 743, 1848, 1669, 444...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestCheckTransferWithProofs(t *testing.T) { to, path := createCheckerTestObjects(t) defer func() { to.stor.close(t) err := common.CleanTemporaryDirs(path) assert.NoError(t, err, "failed to clean test data dirs") }() tx := createTransferWithProofs(t) info := defaultCheckerInfo(t) assetId := tx.FeeAsset.ID _, err := to.tc.checkTransferWithProofs(tx, info) assert.Error(t, err, "checkTransferWithProofs did not fail with invalid transfer asset") to.stor.createAsset(t, assetId) _, err = to.tc.checkTransferWithProofs(tx, info) assert.Error(t, err, "checkTransferWithProofs did not fail prior to SmartAccounts activation") to.stor.activateFeature(t, int16(settings.SmartAccounts)) to.stor.createAsset(t, assetId) _, err = to.tc.checkTransferWithProofs(tx, info) assert.NoError(t, err, "checkTransferWithProofs failed with valid transfer tx") // Check that smart assets are detected properly. to.stor.createSmartAsset(t, tx.AmountAsset.ID) smartAssets, err := to.tc.checkTransferWithProofs(tx, info) assert.NoError(t, err) assert.Equal(t, 1, len(smartAssets)) assert.Equal(t, tx.AmountAsset.ID, smartAssets[0]) // Sponsorship checks. to.stor.activateSponsorship(t) _, err = to.tc.checkTransferWithProofs(tx, info) assert.Error(t, err, "checkTransferWithProofs did not fail with unsponsored asset") assert.EqualError(t, err, fmt.Sprintf("checkFee(): asset %s is not sponsored", assetId.String())) err = to.stor.entities.sponsoredAssets.sponsorAsset(assetId, 10, info.blockID) assert.NoError(t, err, "sponsorAsset() failed") _, err = to.tc.checkTransferWithProofs(tx, info) assert.NoError(t, err, "checkTransferWithProofs failed with valid sponsored asset") tx.Timestamp = 0 _, err = to.tc.checkTransferWithProofs(tx, info) assert.Error(t, err, "checkTransferWithProofs did not fail with invalid timestamp") }
explode_data.jsonl/63076
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 655 }
[ 2830, 3393, 3973, 21970, 2354, 31076, 82, 1155, 353, 8840, 836, 8, 341, 31709, 11, 1815, 1669, 1855, 35188, 2271, 11543, 1155, 692, 16867, 2915, 368, 341, 197, 31709, 1236, 269, 4653, 1155, 692, 197, 9859, 1669, 4185, 727, 2675, 59362, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestGroupByAllNotMarshaled(t *testing.T) { in := ` route: receiver: team-X-mails group_by: [...] receivers: - name: 'team-X-mails' ` c, err := Load(in) if err != nil { t.Fatal("load failed:", err) } dat, err := yaml.Marshal(c) if err != nil { t.Fatal("YAML Marshaling failed:", err) } if strings.Contains(string(dat), "groupbyall") { t.Fatal("groupbyall found in config file") } }
explode_data.jsonl/72917
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 178 }
[ 2830, 3393, 2808, 1359, 2403, 2623, 12061, 75303, 1155, 353, 8840, 836, 8, 341, 17430, 1669, 22074, 8966, 510, 262, 13964, 25, 2083, 30550, 60220, 198, 262, 1874, 3710, 25, 36979, 53387, 1945, 510, 12, 829, 25, 364, 9196, 30550, 60220, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
4
func TestSessionID(t *testing.T) { c1, c2, err := netPipe() if err != nil { t.Fatalf("netPipe: %v", err) } defer c1.Close() defer c2.Close() serverID := make(chan []byte, 1) clientID := make(chan []byte, 1) serverConf := &ServerConfig{ NoClientAuth: true, } serverConf.AddHostKey(testSigners["ecdsa"]) clientConf := &ClientConfig{ User: "user", } go func() { conn, chans, reqs, err := NewServerConn(c1, serverConf) if err != nil { t.Fatalf("server handshake: %v", err) } serverID <- conn.SessionID() go DiscardRequests(reqs) for ch := range chans { ch.Reject(Prohibited, "") } }() go func() { conn, chans, reqs, err := NewClientConn(c2, "", clientConf) if err != nil { t.Fatalf("client handshake: %v", err) } clientID <- conn.SessionID() go DiscardRequests(reqs) for ch := range chans { ch.Reject(Prohibited, "") } }() s := <-serverID c := <-clientID if bytes.Compare(s, c) != 0 { t.Errorf("server session ID (%x) != client session ID (%x)", s, c) } else if len(s) == 0 { t.Errorf("client and server SessionID were empty.") } }
explode_data.jsonl/34805
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 470 }
[ 2830, 3393, 5283, 915, 1155, 353, 8840, 836, 8, 341, 1444, 16, 11, 272, 17, 11, 1848, 1669, 4179, 34077, 741, 743, 1848, 961, 2092, 341, 197, 3244, 30762, 445, 4711, 34077, 25, 1018, 85, 497, 1848, 340, 197, 532, 16867, 272, 16, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestGetAnnotationsForScan(t *testing.T) { tests := []testData{ { in: map[string]string{ "foobar": "bar", }, expectedMapKeyLength: 0, }, { in: map[string]string{ "foobar.securecodebox.io/bar": "bar", }, expectedMapKeyLength: 1, }, { in: map[string]string{ "barfoo.securecodebox.io/bar": "bar", "foo": "bar", }, expectedMapKeyLength: 1, }, { in: map[string]string{ "barfoo.securecodebox.io/bar": "bar", "barfoo.securecodebox.io/foo": "bar", }, expectedMapKeyLength: 2, }, } for _, test := range tests { scheduledScan := executionv1.ScheduledScan{ ObjectMeta: metav1.ObjectMeta{ Name: "foobar", Annotations: test.in, }, } actual := getAnnotationsForScan(scheduledScan) if len(actual) != test.expectedMapKeyLength { t.Error(fmt.Errorf("getAnnotationsForScan should only copy over annotations following the pattern '*.securecodebox.io', but map: %v returned a map with %d keys (%d expected)", test.in, len(actual), test.expectedMapKeyLength)) } } }
explode_data.jsonl/44286
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 484 }
[ 2830, 3393, 1949, 21418, 2461, 26570, 1155, 353, 8840, 836, 8, 341, 78216, 1669, 3056, 1944, 1043, 515, 197, 197, 515, 298, 17430, 25, 2415, 14032, 30953, 515, 571, 197, 1, 50267, 788, 330, 2257, 756, 298, 197, 1583, 298, 42400, 2227,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestFormattedProvider_Close(t *testing.T) { t.Run("Fail to close underlying provider", func(t *testing.T) { provider := formattedstore.NewProvider(&mock.Provider{ErrClose: errors.New("close failure")}, &mockFormatter{useDeterministicKeyFormatting: true}) require.NotNil(t, provider) err := provider.Close() require.EqualError(t, err, "failed to close underlying provider: close failure") }) }
explode_data.jsonl/28238
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 135 }
[ 2830, 3393, 43500, 5179, 68185, 1155, 353, 8840, 836, 8, 341, 3244, 16708, 445, 19524, 311, 3265, 16533, 9109, 497, 2915, 1155, 353, 8840, 836, 8, 341, 197, 197, 19979, 1669, 23126, 4314, 7121, 5179, 2099, 16712, 36208, 90, 7747, 7925, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestBoolOptions(t *testing.T) { var tests = []struct { inOptions types.RoleOptions outCanPortForward bool outCanForwardAgents bool }{ // Setting options explicitly off should remain off. { inOptions: types.RoleOptions{ ForwardAgent: types.NewBool(false), PortForwarding: types.NewBoolOption(false), }, outCanPortForward: false, outCanForwardAgents: false, }, // Not setting options should set port forwarding to true (default enabled) // and agent forwarding false (default disabled). { inOptions: types.RoleOptions{}, outCanPortForward: true, outCanForwardAgents: false, }, // Explicitly enabling should enable them. { inOptions: types.RoleOptions{ ForwardAgent: types.NewBool(true), PortForwarding: types.NewBoolOption(true), }, outCanPortForward: true, outCanForwardAgents: true, }, } for _, tt := range tests { set := NewRoleSet(&types.RoleV4{ Kind: types.KindRole, Version: types.V3, Metadata: types.Metadata{ Name: "role-name", Namespace: apidefaults.Namespace, }, Spec: types.RoleSpecV4{ Options: tt.inOptions, }, }) require.Equal(t, tt.outCanPortForward, set.CanPortForward()) require.Equal(t, tt.outCanForwardAgents, set.CanForwardAgents()) } }
explode_data.jsonl/40081
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 536 }
[ 2830, 3393, 11233, 3798, 1155, 353, 8840, 836, 8, 341, 2405, 7032, 284, 3056, 1235, 341, 197, 17430, 3798, 1843, 4494, 35955, 3798, 198, 197, 13967, 6713, 7084, 25925, 256, 1807, 198, 197, 13967, 6713, 25925, 91804, 1807, 198, 197, 5940...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestShouldReturnTrueWhenCheckingForSchemaDiffSuppressForMatchSpecificationOfApplicationConfigAndValueCannotBeNormalizedAndOldAndNewValueAreEqual(t *testing.T) { resourceHandle := NewApplicationConfigResourceHandle() schema := resourceHandle.MetaData().Schema invalidValue := invalidMatchSpecification require.True(t, schema[ApplicationConfigFieldMatchSpecification].DiffSuppressFunc(ApplicationConfigFieldMatchSpecification, invalidValue, invalidValue, nil)) }
explode_data.jsonl/64919
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 118 }
[ 2830, 3393, 14996, 5598, 2514, 4498, 40129, 2461, 8632, 21751, 17670, 2461, 8331, 56139, 2124, 4988, 2648, 3036, 1130, 17444, 3430, 79082, 3036, 18284, 3036, 3564, 1130, 11526, 2993, 1155, 353, 8840, 836, 8, 341, 50346, 6999, 1669, 1532, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestIsControllerEnabled(t *testing.T) { testcases := []struct { name string controllerName string controllerFlags []string expected bool }{ { name: "on by name", controllerName: "bravo", controllerFlags: []string{"alpha", "bravo", "-charlie"}, expected: true, }, { name: "off by name", controllerName: "charlie", controllerFlags: []string{"alpha", "bravo", "-charlie"}, expected: false, }, { name: "on by default", controllerName: "alpha", controllerFlags: []string{"*"}, expected: true, }, { name: "on by star, not off by name", controllerName: "alpha", controllerFlags: []string{"*", "-charlie"}, expected: true, }, { name: "off by name with star", controllerName: "charlie", controllerFlags: []string{"*", "-charlie"}, expected: false, }, { name: "off then on", controllerName: "alpha", controllerFlags: []string{"-alpha", "alpha"}, expected: false, }, { name: "on then off", controllerName: "alpha", controllerFlags: []string{"alpha", "-alpha"}, expected: true, }, } for _, tc := range testcases { option := NewKubeSphereControllerManagerOptions() option.ControllerGates = tc.controllerFlags actual := option.IsControllerEnabled(tc.controllerName) assert.Equal(t, tc.expected, actual, "%v: expected %v, got %v", tc.name, tc.expected, actual) } }
explode_data.jsonl/16766
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 690 }
[ 2830, 3393, 3872, 2051, 5462, 1155, 353, 8840, 836, 8, 341, 18185, 23910, 1669, 3056, 1235, 341, 197, 11609, 310, 914, 198, 197, 61615, 675, 220, 914, 198, 197, 61615, 9195, 3056, 917, 198, 197, 42400, 286, 1807, 198, 197, 59403, 197,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestKeys(t *testing.T) { s, err := Run() ok(t, err) defer s.Close() c, err := redis.Dial("tcp", s.Addr()) ok(t, err) s.Set("foo", "bar!") s.Set("foobar", "bar!") s.Set("barfoo", "bar!") s.Set("fooooo", "bar!") { v, err := redis.Strings(c.Do("KEYS", "foo")) ok(t, err) equals(t, []string{"foo"}, v) } // simple '*' { v, err := redis.Strings(c.Do("KEYS", "foo*")) ok(t, err) equals(t, []string{"foo", "foobar", "fooooo"}, v) } // simple '?' { v, err := redis.Strings(c.Do("KEYS", "fo?")) ok(t, err) equals(t, []string{"foo"}, v) } // Don't die on never-matching pattern. { v, err := redis.Strings(c.Do("KEYS", `f\`)) ok(t, err) equals(t, []string{}, v) } // Wrong usage { _, err := redis.Int(c.Do("KEYS")) assert(t, err != nil, "do KEYS error") _, err = redis.Int(c.Do("KEYS", "foo", "noint")) assert(t, err != nil, "do KEYS error") } }
explode_data.jsonl/23150
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 456 }
[ 2830, 3393, 8850, 1155, 353, 8840, 836, 8, 341, 1903, 11, 1848, 1669, 6452, 741, 59268, 1155, 11, 1848, 340, 16867, 274, 10421, 741, 1444, 11, 1848, 1669, 20870, 98462, 445, 27161, 497, 274, 93626, 2398, 59268, 1155, 11, 1848, 692, 19...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestFindAllStringIndex(t *testing.T) { for _, test := range findTests { testFindAllIndex(&test, MustCompile(test.pat).FindAllStringIndex(test.text, -1), t) } }
explode_data.jsonl/55090
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 63 }
[ 2830, 3393, 9885, 2403, 703, 1552, 1155, 353, 8840, 836, 8, 341, 2023, 8358, 1273, 1669, 2088, 1477, 18200, 341, 197, 18185, 9885, 2403, 1552, 2099, 1944, 11, 15465, 46126, 8623, 96534, 568, 9885, 2403, 703, 1552, 8623, 2788, 11, 481, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
2
func TestSequence(t *testing.T) { cancel, controller := newController() defer cancel() wfcset := controller.wfclientset.ArgoprojV1alpha1().Workflows("") ctx := context.Background() wf := unmarshalWF(sequence) wf, err := wfcset.Create(ctx, wf, metav1.CreateOptions{}) assert.NoError(t, err) woc := newWorkflowOperationCtx(wf, controller) woc.operate(ctx) updatedWf, err := wfcset.Get(ctx, wf.Name, metav1.GetOptions{}) assert.NoError(t, err) found100 := false found101 := false for _, node := range updatedWf.Status.Nodes { if node.DisplayName == "step1(0:100)" { assert.Equal(t, "100", node.Inputs.Parameters[0].Value.String()) found100 = true } else if node.DisplayName == "step1(1:101)" { assert.Equal(t, "101", node.Inputs.Parameters[0].Value.String()) found101 = true } } assert.Equal(t, true, found100) assert.Equal(t, true, found101) }
explode_data.jsonl/70968
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 353 }
[ 2830, 3393, 14076, 1155, 353, 8840, 836, 8, 341, 84441, 11, 6461, 1669, 501, 2051, 741, 16867, 9121, 741, 6692, 8316, 746, 1669, 6461, 1418, 69, 2972, 746, 18979, 45926, 73, 53, 16, 7141, 16, 1005, 6776, 38140, 445, 5130, 20985, 1669,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
4
func TestCmdNameCompletionInGo(t *testing.T) { rootCmd := &Command{ Use: "root", Run: emptyRun, } childCmd1 := &Command{ Use: "firstChild", Short: "First command", Run: emptyRun, } childCmd2 := &Command{ Use: "secondChild", Run: emptyRun, } hiddenCmd := &Command{ Use: "testHidden", Hidden: true, // Not completed Run: emptyRun, } deprecatedCmd := &Command{ Use: "testDeprecated", Deprecated: "deprecated", // Not completed Run: emptyRun, } aliasedCmd := &Command{ Use: "aliased", Short: "A command with aliases", Aliases: []string{"testAlias", "testSynonym"}, // Not completed Run: emptyRun, } rootCmd.AddCommand(childCmd1, childCmd2, hiddenCmd, deprecatedCmd, aliasedCmd) // Test that sub-command names are completed output, err := executeCommand(rootCmd, ShellCompNoDescRequestCmd, "") if err != nil { t.Errorf("Unexpected error: %v", err) } expected := strings.Join([]string{ "aliased", "completion", "firstChild", "help", "secondChild", ":4", "Completion ended with directive: ShellCompDirectiveNoFileComp", ""}, "\n") if output != expected { t.Errorf("expected: %q, got: %q", expected, output) } // Test that sub-command names are completed with prefix output, err = executeCommand(rootCmd, ShellCompNoDescRequestCmd, "s") if err != nil { t.Errorf("Unexpected error: %v", err) } expected = strings.Join([]string{ "secondChild", ":4", "Completion ended with directive: ShellCompDirectiveNoFileComp", ""}, "\n") if output != expected { t.Errorf("expected: %q, got: %q", expected, output) } // Test that even with no valid sub-command matches, hidden, deprecated and // aliases are not completed output, err = executeCommand(rootCmd, ShellCompNoDescRequestCmd, "test") if err != nil { t.Errorf("Unexpected error: %v", err) } expected = strings.Join([]string{ ":4", "Completion ended with directive: ShellCompDirectiveNoFileComp", ""}, "\n") if output != expected { t.Errorf("expected: %q, got: %q", expected, output) } // Test that sub-command names are completed with description output, err = executeCommand(rootCmd, ShellCompRequestCmd, "") if err != nil { t.Errorf("Unexpected error: %v", err) } expected = strings.Join([]string{ "aliased\tA command with aliases", "completion\tgenerate the autocompletion script for the specified shell", "firstChild\tFirst command", "help\tHelp about any command", "secondChild", ":4", "Completion ended with directive: ShellCompDirectiveNoFileComp", ""}, "\n") if output != expected { t.Errorf("expected: %q, got: %q", expected, output) } }
explode_data.jsonl/43735
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 959 }
[ 2830, 3393, 15613, 675, 33190, 641, 10850, 1155, 353, 8840, 836, 8, 341, 33698, 15613, 1669, 609, 4062, 515, 197, 95023, 25, 330, 2888, 756, 197, 85952, 25, 4287, 6727, 345, 197, 532, 58391, 15613, 16, 1669, 609, 4062, 515, 197, 95023...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
9
func TestService_Handle_EdgeCases(t *testing.T) { t.Run("handleInbound - must not transition to same state", func(t *testing.T) { s, err := New(&protocol.MockProvider{ ServiceMap: map[string]interface{}{ mediator.Coordination: &mockroute.MockMediatorSvc{}, }, }) require.NoError(t, err) err = s.RegisterActionEvent(make(chan service.DIDCommAction)) require.NoError(t, err) response, err := json.Marshal( &Response{ Type: ResponseMsgType, ID: randomString(), Thread: &decorator.Thread{ID: randomString()}, }, ) require.NoError(t, err) didMsg, err := service.ParseDIDCommMsgMap(response) require.NoError(t, err) _, err = s.HandleInbound(didMsg, service.EmptyDIDCommContext()) require.Error(t, err) require.Contains(t, err.Error(), "handle inbound - next state : invalid state transition: "+ "null -> responded") }) t.Run("handleInbound - connection record error", func(t *testing.T) { protocolStateStore := &mockstorage.MockStore{ Store: make(map[string]mockstorage.DBEntry), ErrPut: errors.New("db error"), } prov := &protocol.MockProvider{ ProtocolStateStoreProvider: mockstorage.NewCustomMockStoreProvider(protocolStateStore), ServiceMap: map[string]interface{}{ mediator.Coordination: &mockroute.MockMediatorSvc{}, }, } svc, err := New(prov) require.NoError(t, err) err = svc.RegisterActionEvent(make(chan service.DIDCommAction)) require.NoError(t, err) svc.connectionRecorder, err = connection.NewRecorder(prov) require.NotNil(t, svc.connectionRecorder) require.NoError(t, err) _, err = svc.HandleInbound( generateRequestMsgPayload(t, &protocol.MockProvider{}, randomString(), randomString()), service.EmptyDIDCommContext()) require.Error(t, err) require.Contains(t, err.Error(), "save connection record") }) t.Run("handleInbound - no error", func(t *testing.T) { svc, err := New(&protocol.MockProvider{ ServiceMap: map[string]interface{}{ mediator.Coordination: &mockroute.MockMediatorSvc{}, }, }) require.NoError(t, err) err = svc.RegisterActionEvent(make(chan service.DIDCommAction)) require.NoError(t, err) protocolStateStore := &mockStore{ get: func(s string) (bytes []byte, e error) { return nil, storage.ErrDataNotFound }, put: func(s string, bytes []byte, tags ...storage.Tag) error { if strings.Contains(s, "didex-event-") { return errors.New("db error") } return nil }, } svc.connectionRecorder, err = connection.NewRecorder(&protocol.MockProvider{ ProtocolStateStoreProvider: mockstorage.NewCustomMockStoreProvider(protocolStateStore), }) require.NotNil(t, svc.connectionRecorder) require.NoError(t, err) requestBytes, err := json.Marshal(&Request{ Type: RequestMsgType, ID: generateRandomID(), Connection: &Connection{ DID: "xyz", }, Thread: &decorator.Thread{ PID: randomString(), }, }) require.NoError(t, err) // send invite didMsg, err := service.ParseDIDCommMsgMap(requestBytes) require.NoError(t, err) _, err = svc.HandleInbound(didMsg, service.EmptyDIDCommContext()) require.NoError(t, err) }) }
explode_data.jsonl/30518
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1246 }
[ 2830, 3393, 1860, 42714, 2089, 91691, 37302, 1155, 353, 8840, 836, 8, 341, 3244, 16708, 445, 8192, 641, 10891, 481, 1969, 537, 9142, 311, 1852, 1584, 497, 2915, 1155, 353, 8840, 836, 8, 341, 197, 1903, 11, 1848, 1669, 1532, 2099, 1701...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestOnlyLocalExternalIPs(t *testing.T) { ipt := iptablestest.NewFake() ipvs := ipvstest.NewFake() ipset := ipsettest.NewFake(testIPSetVersion) fp := NewFakeProxier(ipt, ipvs, ipset, nil, nil, v1.IPv4Protocol) svcIP := "10.20.30.41" svcPort := 80 svcExternalIPs := sets.NewString("50.60.70.81", "2012::51", "127.0.0.1") svcPortName := proxy.ServicePortName{ NamespacedName: makeNSN("ns1", "svc1"), Port: "p80", } makeServiceMap(fp, makeTestService(svcPortName.Namespace, svcPortName.Name, func(svc *v1.Service) { svc.Spec.Type = "NodePort" svc.Spec.ClusterIP = svcIP svc.Spec.ExternalIPs = svcExternalIPs.UnsortedList() svc.Spec.Ports = []v1.ServicePort{{ Name: svcPortName.Port, Port: int32(svcPort), Protocol: v1.ProtocolTCP, TargetPort: intstr.FromInt(svcPort), }} svc.Spec.ExternalTrafficPolicy = v1.ServiceExternalTrafficPolicyTypeLocal }), ) epIP := "10.180.0.1" epIP1 := "10.180.1.1" thisHostname := testHostname otherHostname := "other-hostname" tcpProtocol := v1.ProtocolTCP populateEndpointSlices(fp, makeTestEndpointSlice(svcPortName.Namespace, svcPortName.Name, 1, func(eps *discovery.EndpointSlice) { eps.AddressType = discovery.AddressTypeIPv4 eps.Endpoints = []discovery.Endpoint{{ Addresses: []string{epIP}, NodeName: utilpointer.StringPtr(thisHostname), }, { Addresses: []string{epIP1}, NodeName: utilpointer.StringPtr(otherHostname), }} eps.Ports = []discovery.EndpointPort{{ Name: utilpointer.StringPtr(svcPortName.Port), Port: utilpointer.Int32(int32(svcPort)), Protocol: &tcpProtocol, }} }), ) fp.syncProxyRules() // check ipvs service and destinations services, err := ipvs.GetVirtualServers() if err != nil { t.Errorf("Failed to get ipvs services, err: %v", err) } if len(services) != 3 { // ipvs filters out by IPFamily t.Errorf("Expect 3 ipvs services, got %d", len(services)) } found := false for _, svc := range services { if svcExternalIPs.Has(svc.Address.String()) && svc.Port == uint16(svcPort) && svc.Protocol == string(v1.ProtocolTCP) { found = true destinations, _ := ipvs.GetRealServers(svc) if len(destinations) != 1 { t.Errorf("Expect only 1 local endpoint. but got %v", len(destinations)) } for _, dest := range destinations { if dest.Address.String() != epIP || dest.Port != uint16(svcPort) { t.Errorf("service Endpoint mismatch ipvs service destination") } } break } } if !found { t.Errorf("Expect external ip type service, got none") } }
explode_data.jsonl/44356
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1114 }
[ 2830, 3393, 7308, 7319, 25913, 3298, 82, 1155, 353, 8840, 836, 8, 341, 8230, 417, 1669, 66068, 480, 267, 477, 7121, 52317, 741, 46531, 11562, 1669, 45475, 267, 477, 7121, 52317, 741, 46531, 746, 1669, 5997, 746, 1944, 7121, 52317, 8623,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestGetEnvAsURL(t *testing.T) { t.Parallel() testVarKey := "TEST_ONLY_FOR_UNIT_TEST_URL" testURL, err := url.Parse("https://allaboutapps.at/") require.NoError(t, err) panicFunc := func() { _ = util.GetEnvAsURL(testVarKey, "%") } assert.Panics(t, panicFunc) res := util.GetEnvAsURL(testVarKey, "https://allaboutapps.at/") assert.Equal(t, *testURL, *res) os.Setenv(testVarKey, "https://allaboutapps.at/") defer os.Unsetenv(testVarKey) res = util.GetEnvAsURL(testVarKey, "foo") assert.Equal(t, *testURL, *res) os.Setenv(testVarKey, "%") panicFunc = func() { _ = util.GetEnvAsURL(testVarKey, "https://allaboutapps.at/") } assert.Panics(t, panicFunc) }
explode_data.jsonl/6088
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 300 }
[ 2830, 3393, 1949, 14359, 2121, 3144, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 2822, 18185, 3962, 1592, 1669, 330, 10033, 31263, 14516, 31718, 11641, 8000, 698, 18185, 3144, 11, 1848, 1669, 2515, 8937, 445, 2428, 1110, 541, 9096, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestOnEvicted(t *testing.T) { tc := New(DefaultExpiration, 0) tc.Set(v1, 3, DefaultExpiration) works := false tc.OnEvicted(func(k string, v interface{}) { if k == v1 && v.(int) == 3 { works = true } tc.Set(v2, 4, DefaultExpiration) }) tc.Delete(v1) x, _ := tc.Get(v2) if !works { t.Error("works bool not true") } if x.(int) != 4 { t.Error("bar was not 4") } }
explode_data.jsonl/63764
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 179 }
[ 2830, 3393, 1925, 34112, 12770, 1155, 353, 8840, 836, 8, 341, 78255, 1669, 1532, 87874, 66301, 11, 220, 15, 340, 78255, 4202, 3747, 16, 11, 220, 18, 11, 7899, 66301, 340, 197, 18525, 1669, 895, 198, 78255, 8071, 34112, 12770, 18552, 5...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestBidiStreamingRpc(t *testing.T) { bds, err := stub.InvokeRpcBidiStream(context.Background(), "", bidiStreamingMd) testutil.Ok(t, err) req := &grpc_testing.StreamingOutputCallRequest{Payload: payload} for i := 0; i < 3; i++ { err = bds.SendMsg(req) testutil.Ok(t, err, "Failed to send request message") resp, err := bds.RecvMsg() testutil.Ok(t, err, "Failed to receive response message") dm := resp.(*dynamic.Message) fd := dm.GetMessageDescriptor().FindFieldByName("payload") p := dm.GetField(fd) testutil.Require(t, dynamic.MessagesEqual(p.(proto.Message), payload), "Incorrect payload returned from RPC: %v != %v", p, payload) } err = bds.CloseSend() testutil.Ok(t, err, "Failed to receive response") _, err = bds.RecvMsg() testutil.Eq(t, io.EOF, err, "Incorrect number of messages in response") }
explode_data.jsonl/51789
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 324 }
[ 2830, 3393, 33, 12278, 76509, 60248, 1155, 353, 8840, 836, 8, 341, 2233, 5356, 11, 1848, 1669, 13633, 32784, 60248, 33, 12278, 3027, 5378, 19047, 1507, 7342, 79922, 76509, 72529, 340, 18185, 1314, 54282, 1155, 11, 1848, 340, 24395, 1669, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestGetOrders(t *testing.T) { t.Parallel() _, err := b.GetOrders("AUD", "BTC", 10, 0, false) if err == nil { t.Error("Test failed - GetOrders() error", err) } _, err = b.GetOrders("AUD", "BTC", 10, 0, true) if err == nil { t.Error("Test failed - GetOrders() error", err) } }
explode_data.jsonl/48992
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 124 }
[ 2830, 3393, 1949, 24898, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 741, 197, 6878, 1848, 1669, 293, 2234, 24898, 445, 61278, 497, 330, 59118, 497, 220, 16, 15, 11, 220, 15, 11, 895, 340, 743, 1848, 621, 2092, 341, 197, 3244, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestPushToRemoteSuccessBranchTracked(t *testing.T) { testRepo := newTestRepo(t) defer testRepo.cleanup(t) err := testRepo.sut.PushToRemote(git.DefaultRemote, testRepo.branchName) require.Nil(t, err) }
explode_data.jsonl/14032
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 85 }
[ 2830, 3393, 16644, 1249, 24703, 7188, 18197, 1282, 11191, 1155, 353, 8840, 836, 8, 341, 18185, 25243, 1669, 501, 2271, 25243, 1155, 340, 16867, 1273, 25243, 87689, 1155, 692, 9859, 1669, 1273, 25243, 514, 332, 34981, 1249, 24703, 3268, 27...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
1
func TestMapHasEqualOrContainingPath(t *testing.T) { testMapHasEqualOrContainingPath(t, true, "a.proto", "a.proto") testMapHasEqualOrContainingPath(t, false, ".", "a.proto") testMapHasEqualOrContainingPath(t, true, "a.proto", ".") testMapHasEqualOrContainingPath(t, true, "a/b.proto", ".") testMapHasEqualOrContainingPath(t, true, "a/b", ".") testMapHasEqualOrContainingPath(t, false, "ab/c", "a", "b") testMapHasEqualOrContainingPath(t, true, "a/b/c", "a", "b") testMapHasEqualOrContainingPath(t, false, "a/b/c", "b") testMapHasEqualOrContainingPath(t, true, "b/b/c", "b") testMapHasEqualOrContainingPath(t, true, "b/a/c", "b") testMapHasEqualOrContainingPath(t, true, "b/b/c", "b", ".") }
explode_data.jsonl/11908
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 307 }
[ 2830, 3393, 2227, 10281, 2993, 2195, 86641, 1820, 1155, 353, 8840, 836, 8, 341, 18185, 2227, 10281, 2993, 2195, 86641, 1820, 1155, 11, 830, 11, 330, 64, 57322, 497, 330, 64, 57322, 1138, 18185, 2227, 10281, 2993, 2195, 86641, 1820, 1155...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestResponseError(t *testing.T) { err := errors.New("error message") re := &ResponseError{ Response: &Response{}, Err: err, } assertNotNil(t, re.Unwrap()) assertEqual(t, err.Error(), re.Error()) }
explode_data.jsonl/39361
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 88 }
[ 2830, 3393, 2582, 1454, 1155, 353, 8840, 836, 8, 341, 9859, 1669, 5975, 7121, 445, 841, 1943, 1138, 17200, 1669, 609, 2582, 1454, 515, 197, 69604, 25, 609, 2582, 38837, 197, 197, 7747, 25, 414, 1848, 345, 197, 532, 6948, 96144, 1155, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
1
func TestGetAllReadingsError(t *testing.T) { reset() Configuration.Service.MaxResultCount = 5 myMock := &dbMock.DBClient{} myMock.On("Readings").Return([]models.Reading{}, fmt.Errorf("some error")) dbClient = myMock _, err := getAllReadings(logger.NewMockClient()) if err == nil { t.Errorf("Expected error getting all readings") } }
explode_data.jsonl/48166
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 126 }
[ 2830, 3393, 1949, 2403, 4418, 819, 1454, 1155, 353, 8840, 836, 8, 341, 70343, 741, 197, 7688, 13860, 14535, 2077, 2507, 284, 220, 20, 198, 13624, 11571, 1669, 609, 1999, 11571, 22537, 2959, 31483, 13624, 11571, 8071, 445, 4418, 819, 182...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestASG(t *testing.T) { RegisterFailHandler(Fail) var specReporters []Reporter junitReporter := reporters.NewJUnitReporter("/testresults/junit_basic.xml") specReporters = append(specReporters, junitReporter) RunSpecsWithDefaultAndCustomReporters(t, "Torpedo : ASG", specReporters) }
explode_data.jsonl/51103
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 100 }
[ 2830, 3393, 1911, 38, 1155, 353, 8840, 836, 8, 341, 79096, 19524, 3050, 7832, 604, 692, 2405, 1398, 10361, 388, 3056, 52766, 198, 12428, 3843, 52766, 1669, 19040, 7121, 56248, 52766, 4283, 1944, 8074, 4437, 3843, 34729, 9028, 1138, 98100,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestValidType(t *testing.T) { resolvers := &Stub{} resolvers.QueryResolver.ValidType = func(ctx context.Context) (validType *ValidType, e error) { return &ValidType{ DifferentCase: "new", DifferentCaseOld: "old", }, nil } c := client.New(handler.NewDefaultServer(NewExecutableSchema(Config{Resolvers: resolvers}))) t.Run("fields with differing cases can be distinguished", func(t *testing.T) { var resp struct { ValidType struct { New string `json:"differentCase"` Old string `json:"different_case"` } } err := c.Post(`query { validType { differentCase, different_case } }`, &resp) require.NoError(t, err) require.Equal(t, "new", resp.ValidType.New) require.Equal(t, "old", resp.ValidType.Old) }) }
explode_data.jsonl/6425
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 285 }
[ 2830, 3393, 4088, 929, 1155, 353, 8840, 836, 8, 341, 10202, 39435, 1669, 609, 33838, 16094, 10202, 39435, 15685, 18190, 47156, 929, 284, 2915, 7502, 2266, 9328, 8, 320, 1891, 929, 353, 4088, 929, 11, 384, 1465, 8, 341, 197, 853, 609, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestDefaultMetrics(t *testing.T) { buildInfo := component.BuildInfo{ Version: "1.0", Command: "otelcontribcol", } ms := DefaultMetrics("metrics", "test-host", uint64(2e9), buildInfo) assert.Equal(t, "otel.datadog_exporter.metrics.running", *ms[0].Metric) // Assert metrics list length (should be 1) assert.Equal(t, 1, len(ms)) // Assert timestamp assert.Equal(t, 2.0, *ms[0].Points[0][0]) // Assert value (should always be 1.0) assert.Equal(t, 1.0, *ms[0].Points[0][1]) // Assert hostname tag is set assert.Equal(t, "test-host", *ms[0].Host) // Assert no other tags are set assert.ElementsMatch(t, []string{"version:1.0", "command:otelcontribcol"}, ms[0].Tags) }
explode_data.jsonl/46797
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 280 }
[ 2830, 3393, 3675, 27328, 1155, 353, 8840, 836, 8, 341, 69371, 1731, 1669, 3692, 25212, 1731, 515, 197, 77847, 25, 330, 16, 13, 15, 756, 197, 97493, 25, 330, 40785, 47110, 2074, 756, 197, 630, 47691, 1669, 7899, 27328, 445, 43262, 497,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestUpdate_assignOriginalAnnotation(t *testing.T) { oldRc := oldRc(1, 1) delete(oldRc.Annotations, originalReplicasAnnotation) newRc := newRc(1, 1) var updatedOldRc *api.ReplicationController fake := &testclient.Fake{} fake.AddReactor("*", "*", func(action testclient.Action) (handled bool, ret runtime.Object, err error) { switch a := action.(type) { case testclient.GetAction: return true, oldRc, nil case testclient.UpdateAction: updatedOldRc = a.GetObject().(*api.ReplicationController) return true, updatedOldRc, nil } return false, nil, nil }) updater := &RollingUpdater{ c: fake, ns: "default", scaleAndWait: func(rc *api.ReplicationController, retry *RetryParams, wait *RetryParams) (*api.ReplicationController, error) { return rc, nil }, getOrCreateTargetController: func(controller *api.ReplicationController, sourceId string) (*api.ReplicationController, bool, error) { return newRc, false, nil }, cleanup: func(oldRc, newRc *api.ReplicationController, config *RollingUpdaterConfig) error { return nil }, waitForReadyPods: func(interval, timeout time.Duration, oldRc, newRc *api.ReplicationController) (int, int, error) { return 1, 1, nil }, } var buffer bytes.Buffer config := &RollingUpdaterConfig{ Out: &buffer, OldRc: oldRc, NewRc: newRc, UpdatePeriod: 0, Interval: time.Millisecond, Timeout: time.Millisecond, CleanupPolicy: DeleteRollingUpdateCleanupPolicy, MaxUnavailable: intstr.FromString("100%"), } err := updater.Update(config) if err != nil { t.Fatalf("unexpected error: %v", err) } if updatedOldRc == nil { t.Fatalf("expected rc to be updated") } if e, a := "1", updatedOldRc.Annotations[originalReplicasAnnotation]; e != a { t.Fatalf("expected annotation value %s, got %s", e, a) } }
explode_data.jsonl/52533
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 728 }
[ 2830, 3393, 4289, 20688, 18395, 19711, 1155, 353, 8840, 836, 8, 341, 61828, 49, 66, 1669, 2310, 49, 66, 7, 16, 11, 220, 16, 340, 15618, 21972, 49, 66, 91172, 11, 4024, 18327, 52210, 19711, 340, 8638, 49, 66, 1669, 501, 49, 66, 7, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestAccKeycloakOpenidClientOptionalScopes_authoritativeRemove(t *testing.T) { realm := "terraform-realm-" + acctest.RandString(10) client := "terraform-client-" + acctest.RandString(10) randomClientScopes := []string{ "terraform-client-scope-" + acctest.RandString(10), "terraform-client-scope-" + acctest.RandString(10), "terraform-client-scope-" + acctest.RandString(10), } allClientScopes := append(preAssignedOptionalClientScopes, randomClientScopes...) clientToManuallyAttach := randomClientScopes[acctest.RandIntRange(0, len(randomClientScopes)-1)] var attachedClientScopes []string for _, clientScope := range allClientScopes { if clientScope != clientToManuallyAttach { attachedClientScopes = append(attachedClientScopes, clientScope) } } resource.Test(t, resource.TestCase{ Providers: testAccProviders, PreCheck: func() { testAccPreCheck(t) }, Steps: []resource.TestStep{ { Config: testKeycloakOpenidClientOptionalScopes_multipleClientScopes(realm, client, allClientScopes, attachedClientScopes), Check: testAccCheckKeycloakOpenidClientHasOptionalScopes("keycloak_openid_client_optional_scopes.optional_scopes", attachedClientScopes), }, { PreConfig: func() { keycloakClient := testAccProvider.Meta().(*keycloak.KeycloakClient) client, err := keycloakClient.GetOpenidClientByClientId(realm, client) if err != nil { t.Fatal(err) } err = keycloakClient.AttachOpenidClientOptionalScopes(realm, client.Id, []string{clientToManuallyAttach}) if err != nil { t.Fatal(err) } }, Config: testKeycloakOpenidClientOptionalScopes_multipleClientScopes(realm, client, allClientScopes, attachedClientScopes), Check: resource.ComposeTestCheckFunc( testAccCheckKeycloakOpenidClientHasOptionalScopes("keycloak_openid_client_optional_scopes.optional_scopes", attachedClientScopes), testAccCheckKeycloakOpenidClientOptionalScopeIsNotAttached("keycloak_openid_client_optional_scopes.optional_scopes", clientToManuallyAttach), ), }, }, }) }
explode_data.jsonl/31489
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 756 }
[ 2830, 3393, 14603, 1592, 88751, 5002, 307, 2959, 15309, 3326, 18523, 22938, 21312, 13021, 1155, 353, 8840, 836, 8, 341, 17200, 7673, 1669, 330, 61385, 5504, 7673, 27651, 488, 1613, 67880, 2013, 437, 703, 7, 16, 15, 340, 25291, 1669, 330...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestClient_grpcNotAllowed(t *testing.T) { process := helperProcess("test-grpc") c := NewClient(&ClientConfig{ Cmd: process, HandshakeConfig: testHandshake, Plugins: testPluginMap, }) defer c.Kill() if _, err := c.Start(); err == nil { t.Fatal("should error") } }
explode_data.jsonl/57838
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 129 }
[ 2830, 3393, 2959, 15682, 3992, 97634, 1155, 353, 8840, 836, 8, 341, 53314, 1669, 13137, 7423, 445, 1944, 24321, 3992, 1138, 1444, 1669, 1532, 2959, 2099, 2959, 2648, 515, 197, 6258, 2277, 25, 1797, 1882, 345, 197, 197, 2314, 29661, 2648...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestDBStore(t *testing.T) { dir, err := ioutil.TempDir("", "db_store_test") if err != nil { panic(err) } defer os.RemoveAll(dir) store, err := NewDBStore(dir) if err != nil { t.Fatal(err) } testStore(t, store) store.Close() persistedStore, err := NewDBStore(dir) if err != nil { t.Fatal(err) } defer persistedStore.Close() testPersistedStore(t, persistedStore) }
explode_data.jsonl/1301
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 165 }
[ 2830, 3393, 3506, 6093, 1155, 353, 8840, 836, 8, 341, 48532, 11, 1848, 1669, 43144, 65009, 6184, 19814, 330, 1999, 14809, 4452, 1138, 743, 1848, 961, 2092, 341, 197, 30764, 3964, 340, 197, 532, 16867, 2643, 84427, 14161, 692, 57279, 11,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
4
func Test_exec(t *testing.T) { serverURL, mux, teardown := setupServerMock() defer teardown() // Only testing how many requests are received by ChartMuseum Mock // not testing the functionality of the cmclient var reqNum int mux.HandleFunc("/", func(w http.ResponseWriter, req *http.Request) { // will break if these tests are flagged t.Parallel() reqNum++ w.WriteHeader(http.StatusOK) w.Header().Set("Content-Type", "appliction/json") io.WriteString(w, `{"saved": true}`) }) saveDir := filepath.Join(testChartsDir, "uploads") // plugin Exec() doesn't delete saveDir when done // this test cleans up after itself defer func() { os.RemoveAll(saveDir) }() tests := []struct { name string p *Plugin reqNum int err error }{ { name: "Test package and upload 1 chart", p: &Plugin{ Config: &Config{ RepoURL: serverURL, ChartsDir: testChartsDir, ChartPath: "chart1", SaveDir: saveDir, }, }, reqNum: 1, err: nil, }, { name: "Test package and upload all(4) test charts", p: &Plugin{ Config: &Config{ RepoURL: serverURL, ChartsDir: testChartsDir, SaveDir: saveDir, }, }, reqNum: 4, err: nil, }, } for _, test := range tests { reqNum = 0 t.Run(test.name, func(t *testing.T) { if err := test.p.exec(); err != test.err { t.Error(err) return } }) if reqNum != test.reqNum { t.Errorf("Want %d upload(s), got %d instead", test.reqNum, reqNum) } } }
explode_data.jsonl/58796
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 654 }
[ 2830, 3393, 18430, 1155, 353, 8840, 836, 8, 341, 41057, 3144, 11, 59807, 11, 49304, 1669, 6505, 5475, 11571, 741, 16867, 49304, 2822, 197, 322, 8278, 7497, 1246, 1657, 7388, 525, 3949, 553, 21266, 44, 11509, 14563, 198, 197, 322, 537, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestServer_CloseNotify_After_RSTStream(t *testing.T) { testServerPostUnblock(t, blockUntilClosed, func(st *serverTester) { if err := st.fr.WriteRSTStream(1, ErrCodeCancel); err != nil { t.Fatal(err) } }, nil) }
explode_data.jsonl/71647
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 93 }
[ 2830, 3393, 5475, 68185, 28962, 1566, 1046, 64093, 3027, 1155, 353, 8840, 836, 8, 341, 18185, 5475, 4133, 1806, 4574, 1155, 11, 2504, 24493, 26884, 11, 2915, 5895, 353, 4030, 58699, 8, 341, 197, 743, 1848, 1669, 357, 18798, 4073, 49, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestHostnameRFC1123AliasValidation(t *testing.T) { tests := []struct { param string expected bool }{ {"test.example.com", true}, {"example.com", true}, {"example24.com", true}, {"test.example24.com", true}, {"test24.example24.com", true}, {"example", true}, {"1.foo.com", true}, {"test.example.com.", false}, {"example.com.", false}, {"example24.com.", false}, {"test.example24.com.", false}, {"test24.example24.com.", false}, {"example.", false}, {"192.168.0.1", true}, {"email@example.com", false}, {"2001:cdba:0000:0000:0000:0000:3257:9652", false}, {"2001:cdba:0:0:0:0:3257:9652", false}, {"2001:cdba::3257:9652", false}, } validate := New() validate.RegisterAlias("hostname", "hostname_rfc1123") for i, test := range tests { errs := validate.Var(test.param, "hostname") if test.expected { if !IsEqual(errs, nil) { t.Fatalf("Index: %d hostname failed Error: %v", i, errs) } } else { if IsEqual(errs, nil) { t.Fatalf("Index: %d hostname failed Error: %v", i, errs) } else { val := getError(errs, "", "") if val.Tag() != "hostname" { t.Fatalf("Index: %d hostname failed Error: %v", i, errs) } } } } }
explode_data.jsonl/77353
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 532 }
[ 2830, 3393, 88839, 64371, 16, 16, 17, 18, 22720, 13799, 1155, 353, 8840, 836, 8, 341, 78216, 1669, 3056, 1235, 341, 197, 36037, 262, 914, 198, 197, 42400, 1807, 198, 197, 59403, 197, 197, 4913, 1944, 7724, 905, 497, 830, 1583, 197, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
6
func TestHybiServerRead(t *testing.T) { wireData := []byte{0x81, 0x85, 0xcc, 0x55, 0x80, 0x20, 0xa4, 0x30, 0xec, 0x4c, 0xa3, // hello 0x89, 0x85, 0xcc, 0x55, 0x80, 0x20, 0xa4, 0x30, 0xec, 0x4c, 0xa3, // ping: hello 0x81, 0x85, 0xed, 0x83, 0xb4, 0x24, 0x9a, 0xec, 0xc6, 0x48, 0x89, // world } br := bufio.NewReader(bytes.NewBuffer(wireData)) bw := bufio.NewWriter(bytes.NewBuffer([]byte{})) conn := newHybiConn(newConfig(t, "/"), bufio.NewReadWriter(br, bw), nil, new(http.Request)) expected := [][]byte{[]byte("hello"), []byte("world")} msg := make([]byte, 512) n, err := conn.Read(msg) if err != nil { t.Errorf("read 1st frame, error %q", err) } if n != 5 { t.Errorf("read 1st frame, expect 5, got %d", n) } if !bytes.Equal(expected[0], msg[:n]) { t.Errorf("read 1st frame %q, got %q", expected[0], msg[:n]) } n, err = conn.Read(msg) if err != nil { t.Errorf("read 2nd frame, error %q", err) } if n != 5 { t.Errorf("read 2nd frame, expect 5, got %d", n) } if !bytes.Equal(expected[1], msg[:n]) { t.Errorf("read 2nd frame %q, got %q", expected[1], msg[:n]) } n, err = conn.Read(msg) if err == nil { t.Errorf("read not EOF") } if n != 0 { t.Errorf("expect read 0, got %d", n) } }
explode_data.jsonl/53447
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 601 }
[ 2830, 3393, 30816, 8221, 5475, 4418, 1155, 353, 8840, 836, 8, 341, 6692, 554, 1043, 1669, 3056, 3782, 90, 15, 87, 23, 16, 11, 220, 15, 87, 23, 20, 11, 220, 15, 47380, 11, 220, 15, 87, 20, 20, 11, 220, 15, 87, 23, 15, 11, 220...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
9
func Test_Lbank(t *testing.T) { e := InitLbank() pair := pair.GetPairByKey("BTC|ETH") Test_Coins(e) Test_Pairs(e) Test_Pair(e, pair) Test_Orderbook(e, pair) Test_ConstraintFetch(e, pair) Test_Constraint(e, pair) // Test_Balance(e, pair) // Test_Trading(e, pair, 0.00000001, 100) // Test_Withdraw(e, pair.Base, 1, "ADDRESS") }
explode_data.jsonl/53591
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 156 }
[ 2830, 3393, 2351, 17033, 1155, 353, 8840, 836, 8, 341, 7727, 1669, 15690, 43, 17033, 2822, 3223, 1310, 1669, 6716, 2234, 12443, 67749, 445, 59118, 91, 7625, 5130, 73866, 920, 68798, 2026, 340, 73866, 1088, 4720, 2026, 340, 73866, 1088, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestBlockingEnqueue(t *testing.T) { // Scenario: In parallel, get blocks from gossip and from the orderer. // The blocks from the orderer we get are X2 times the amount of blocks from gossip. // The blocks we get from gossip are random indices, to maximize disruption. t.Parallel() mc := &mockCommitter{Mock: &mock.Mock{}} blocksPassedToLedger := make(chan uint64, 10) mc.On("CommitWithPvtData", mock.Anything).Run(func(arg mock.Arguments) { blocksPassedToLedger <- arg.Get(0).(*pcomm.Block).Header.Number }) mc.On("LedgerHeight", mock.Anything).Return(uint64(1), nil) mc.On("DoesPvtDataInfoExistInLedger", mock.Anything).Return(false, nil) g := &mocks.GossipMock{} g.On("Accept", mock.Anything, false).Return(make(<-chan *proto.GossipMessage), nil) g.On("Accept", mock.Anything, true).Return(nil, make(chan proto.ReceivedMessage)) p := newPeerNode(0, mc, noopPeerIdentityAcceptor) defer p.shutdown() numBlocksReceived := 500 receivedBlockCount := 0 // Get a block from the orderer every 1ms go func() { for i := 1; i <= numBlocksReceived; i++ { rawblock := pcomm.NewBlock(uint64(i), []byte{}) b, _ := pb.Marshal(rawblock) block := &proto.Payload{ SeqNum: uint64(i), Data: b, } p.s.AddPayload(block) time.Sleep(time.Millisecond) } }() // Get a block from gossip every 1ms too go func() { rand.Seed(time.Now().UnixNano()) for i := 1; i <= numBlocksReceived/2; i++ { blockSeq := rand.Intn(numBlocksReceived) rawblock := pcomm.NewBlock(uint64(blockSeq), []byte{}) b, _ := pb.Marshal(rawblock) block := &proto.Payload{ SeqNum: uint64(blockSeq), Data: b, } p.s.addPayload(block, NonBlocking) time.Sleep(time.Millisecond) } }() for { receivedBlock := <-blocksPassedToLedger receivedBlockCount++ m := &mock.Mock{} m.On("LedgerHeight", mock.Anything).Return(receivedBlock, nil) m.On("DoesPvtDataInfoExistInLedger", mock.Anything).Return(false, nil) m.On("CommitWithPvtData", mock.Anything).Run(func(arg mock.Arguments) { blocksPassedToLedger <- arg.Get(0).(*pcomm.Block).Header.Number }) mc.Lock() mc.Mock = m mc.Unlock() assert.Equal(t, receivedBlock, uint64(receivedBlockCount)) if int(receivedBlockCount) == numBlocksReceived { break } time.Sleep(time.Millisecond * 10) } }
explode_data.jsonl/5638
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 929 }
[ 2830, 3393, 48266, 1702, 4584, 1155, 353, 8840, 836, 8, 341, 197, 322, 58663, 25, 758, 15279, 11, 633, 10010, 504, 57487, 323, 504, 279, 1973, 261, 624, 197, 322, 576, 10010, 504, 279, 1973, 261, 582, 633, 525, 1599, 17, 3039, 279, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestResourcePermissionsCreate_no_access_control(t *testing.T) { qa.ResourceFixture{ Fixtures: []qa.HTTPFixture{}, Resource: ResourcePermissions(), Create: true, State: map[string]interface{}{ "cluster_id": "abc", }, }.ExpectError(t, "invalid config supplied. [access_control] Missing required argument") }
explode_data.jsonl/50876
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 115 }
[ 2830, 3393, 4783, 23851, 4021, 6536, 12759, 13436, 1155, 353, 8840, 836, 8, 341, 197, 15445, 20766, 18930, 515, 197, 12727, 941, 18513, 25, 3056, 15445, 27358, 18930, 38837, 197, 79487, 25, 11765, 23851, 3148, 197, 75569, 25, 256, 830, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestExpiredInstance(t *testing.T) { connection := &testConnection{ errHeartbeat: errNotFound, } registrar := NewRegistrar(connection, instanceTest1, loggerTest) registrar.Register() // Wait for a heartbeat failure. time.Sleep(1010 * time.Millisecond) if want, have := 1, len(connection.instances); want != have { t.Errorf("want %d, have %d", want, have) } }
explode_data.jsonl/53334
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 132 }
[ 2830, 3393, 54349, 2523, 1155, 353, 8840, 836, 8, 341, 54590, 1669, 609, 1944, 4526, 515, 197, 9859, 45384, 22227, 25, 1848, 10372, 345, 197, 630, 37013, 34765, 1669, 1532, 70252, 24147, 11, 2867, 2271, 16, 11, 5925, 2271, 340, 37013, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestPipelineRunDescribe_not_found(t *testing.T) { ns := []*corev1.Namespace{ { ObjectMeta: metav1.ObjectMeta{ Name: "ns", }, }, } cs, _ := test.SeedTestData(t, pipelinetest.Data{Namespaces: ns}) cs.Pipeline.Resources = cb.APIResourceList("v1alpha1", []string{"pipelinerun"}) tdc := testDynamic.Options{} dynamic, err := tdc.Client() if err != nil { fmt.Println(err) } p := &test.Params{Tekton: cs.Pipeline, Kube: cs.Kube, Dynamic: dynamic} pipelinerun := Command(p) _, err = test.ExecuteCommand(pipelinerun, "desc", "bar", "-n", "ns") if err == nil { t.Errorf("Expected error, did not get any") } expected := "failed to find pipelinerun \"bar\"" test.AssertOutput(t, expected, err.Error()) }
explode_data.jsonl/7901
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 310 }
[ 2830, 3393, 34656, 6727, 74785, 7913, 21480, 1155, 353, 8840, 836, 8, 341, 84041, 1669, 29838, 98645, 16, 46011, 515, 197, 197, 515, 298, 23816, 12175, 25, 77520, 16, 80222, 515, 571, 21297, 25, 330, 4412, 756, 298, 197, 1583, 197, 19...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestArray(t *testing.T) { require := require.New(t) typ := Array(Int64) _, err := typ.Convert("foo") require.Error(err) require.True(ErrNotArray.Is(err)) convert(t, typ, []interface{}{1, 2, 3}, []interface{}{int64(1), int64(2), int64(3)}) require.Equal(sqltypes.TypeJSON, typ.Type()) lt(t, typ, []interface{}{5, 6}, []interface{}{2, 2, 3}) lt(t, typ, []interface{}{1, 2, 3}, []interface{}{2, 2, 3}) lt(t, typ, []interface{}{1, 2, 3}, []interface{}{1, 3, 3}) lt(t, typ, []interface{}{1, 2, 3}, []interface{}{1, 2, 4}) eq(t, typ, []interface{}{1, 2, 3}, []interface{}{1, 2, 3}) gt(t, typ, []interface{}{2, 2, 3}, []interface{}{1, 2, 3}) gt(t, typ, []interface{}{1, 3, 3}, []interface{}{1, 2, 3}) gt(t, typ, []interface{}{1, 2, 4}, []interface{}{1, 2, 3}) gt(t, typ, []interface{}{1, 2, 4}, []interface{}{5, 6}) }
explode_data.jsonl/54307
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 372 }
[ 2830, 3393, 1857, 1155, 353, 8840, 836, 8, 341, 17957, 1669, 1373, 7121, 1155, 692, 25314, 1669, 2910, 24123, 21, 19, 340, 197, 6878, 1848, 1669, 3582, 36179, 445, 7975, 1138, 17957, 6141, 3964, 340, 17957, 32443, 7, 7747, 2623, 1857, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestConnectCancellation(t *testing.T) { srv := serve(func(conn) {}) defer srv.Close() ctx, cancel := context.WithCancel(context.Background()) cancel() conn, err := DefaultDialer.DialContext(ctx, "ws://"+srv.Listener.Addr().String()) assert.Error(t, err) assert.Nil(t, conn) }
explode_data.jsonl/9354
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 111 }
[ 2830, 3393, 14611, 82298, 1155, 353, 8840, 836, 8, 341, 1903, 10553, 1669, 8683, 18552, 20571, 8, 35248, 16867, 43578, 10421, 2822, 20985, 11, 9121, 1669, 2266, 26124, 9269, 5378, 19047, 2398, 84441, 2822, 32917, 11, 1848, 1669, 7899, 35,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestTableEmptyStr(t *testing.T) { var buf strings.Builder assert.Nil(t, NewTable(WithWriter(&buf)).Header([]string{"", "bb"}).Flush()) assert.True(t, strings.Contains(buf.String(), "<NIL>")) var buf2 strings.Builder assert.Nil(t, NewTable(WithWriter(&buf2)).Data([][]string{{"", "bb"}, {"", ""}}).Flush()) assert.Equal(t, 3, strings.Count(buf2.String(), "<nil>")) }
explode_data.jsonl/69434
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 143 }
[ 2830, 3393, 2556, 3522, 2580, 1155, 353, 8840, 836, 8, 341, 2405, 6607, 9069, 15641, 198, 6948, 59678, 1155, 11, 1532, 2556, 7, 2354, 6492, 2099, 5909, 4579, 4047, 10556, 917, 4913, 497, 330, 6066, 9207, 568, 46874, 2398, 6948, 32443, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestRunFailsWithUnknownTest(t *testing.T) { logs := []string{} config := &Config{ args: []string{".binary", "4"}, logf: func(f string, a ...interface{}) { fmt.Printf(f+"\n", a...) logs = append(logs, fmt.Sprintf(f, a...)) }, puzzles: testPuzzles(), } err := Run(config) require.Error(t, err) assert.Contains(t, err.Error(), "3 out of range, there are only 3 puzzles registered so far") }
explode_data.jsonl/67964
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 170 }
[ 2830, 3393, 6727, 37, 6209, 2354, 13790, 2271, 1155, 353, 8840, 836, 8, 341, 6725, 82, 1669, 3056, 917, 16094, 25873, 1669, 609, 2648, 515, 197, 31215, 25, 3056, 917, 90, 3263, 25891, 497, 330, 19, 7115, 197, 6725, 69, 25, 2915, 955...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1