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 TestGetMigSize(t *testing.T) { server := NewHttpServerMock() defer server.Close() g := newTestGceManager(t, server.URL, false) server.On("handle", "/project1/zones/us-central1-b/instanceGroupManagers/extra-pool-323233232").Return(instanceGroupManagerResponseTemplate).Once() mig := &gceMig{ gceRef: GceRef{ Project: projectId, Zone: zoneB, Name: "extra-pool-323233232", }, gceManager: g, minSize: 0, maxSize: 1000, } size, err := g.GetMigSize(mig) assert.NoError(t, err) assert.Equal(t, int64(3), size) mock.AssertExpectationsForObjects(t, server) }
explode_data.jsonl/27609
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 257 }
[ 2830, 3393, 1949, 44, 343, 1695, 1155, 353, 8840, 836, 8, 341, 41057, 1669, 1532, 2905, 5475, 11571, 741, 16867, 3538, 10421, 741, 3174, 1669, 501, 2271, 38, 346, 2043, 1155, 11, 3538, 20893, 11, 895, 692, 41057, 8071, 445, 8192, 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 TestSpanLinkSlice_CopyTo(t *testing.T) { dest := NewSpanLinkSlice() // Test CopyTo to empty NewSpanLinkSlice().CopyTo(dest) assert.EqualValues(t, NewSpanLinkSlice(), dest) // Test CopyTo larger slice generateTestSpanLinkSlice().CopyTo(dest) assert.EqualValues(t, generateTestSpanLinkSlice(), dest) // Test CopyTo same size slice generateTestSpanLinkSlice().CopyTo(dest) assert.EqualValues(t, generateTestSpanLinkSlice(), dest) }
explode_data.jsonl/63290
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 161 }
[ 2830, 3393, 12485, 3939, 33236, 77637, 1249, 1155, 353, 8840, 836, 8, 341, 49616, 1669, 1532, 12485, 3939, 33236, 741, 197, 322, 3393, 14540, 1249, 311, 4287, 198, 197, 3564, 12485, 3939, 33236, 1005, 12106, 1249, 27010, 340, 6948, 12808,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestBuildMultiTag(t *testing.T) { runWithDindSwarmAndRegistry(t, func(info dindSwarmAndRegistryInfo) { cmd := info.configuredCmd tmp := fs.NewDir(t, "TestBuild") testDir := path.Join("testdata", "build") iidfile := tmp.Join("iidfile") tags := []string{"1.0.0", "latest"} cmd.Command = dockerCli.Command("app", "build", "--tag", "single:"+tags[0], "--tag", "single:"+tags[1], "--iidfile", iidfile, "-f", path.Join(testDir, "single.dockerapp"), testDir) icmd.RunCmd(cmd).Assert(t, icmd.Success) }) }
explode_data.jsonl/72001
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 211 }
[ 2830, 3393, 11066, 20358, 5668, 1155, 353, 8840, 836, 8, 341, 56742, 2354, 35, 484, 13218, 2178, 3036, 15603, 1155, 11, 2915, 14208, 294, 484, 13218, 2178, 3036, 15603, 1731, 8, 341, 197, 25920, 1669, 3546, 5423, 3073, 15613, 198, 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 TestMarshalURL(t *testing.T) { urlp, err := url.Parse("http://example.com/") if err != nil { t.Fatal(err) } u := &URL{urlp} c, err := json.Marshal(u) if err != nil { t.Fatal(err) } require.Equal(t, "\"http://example.com/\"", string(c), "URL not properly marshalled in JSON.") c, err = yaml.Marshal(u) if err != nil { t.Fatal(err) } require.Equal(t, "http://example.com/\n", string(c), "URL not properly marshalled in YAML.") }
explode_data.jsonl/72911
{ "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, 55438, 3144, 1155, 353, 8840, 836, 8, 341, 19320, 79, 11, 1848, 1669, 2515, 8937, 445, 1254, 1110, 8687, 905, 53006, 743, 1848, 961, 2092, 341, 197, 3244, 26133, 3964, 340, 197, 532, 10676, 1669, 609, 3144, 90, 1085, 79, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestCreateHTTPLoadBalancer(t *testing.T) { // This should NOT create the forwarding rule and target proxy // associated with the HTTPS branch of this loadbalancer. lbInfo := &L7RuntimeInfo{Name: "test", AllowHTTP: true} f := NewFakeLoadBalancers(lbInfo.Name) pool := newFakeLoadBalancerPool(f, t) pool.Add(lbInfo) l7, err := pool.Get(lbInfo.Name) if err != nil || l7 == nil { t.Fatalf("Expected l7 not created") } um, err := f.GetUrlMap(f.umName()) if err != nil || um.DefaultService != pool.(*L7s).glbcDefaultBackend.SelfLink { t.Fatalf("%v", err) } tp, err := f.GetTargetHttpProxy(f.tpName(false)) if err != nil || tp.UrlMap != um.SelfLink { t.Fatalf("%v", err) } fw, err := f.GetGlobalForwardingRule(f.fwName(false)) if err != nil || fw.Target != tp.SelfLink { t.Fatalf("%v", err) } }
explode_data.jsonl/49950
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 325 }
[ 2830, 3393, 4021, 2545, 77510, 2731, 93825, 1155, 353, 8840, 836, 8, 341, 197, 322, 1096, 1265, 4183, 1855, 279, 62104, 5912, 323, 2169, 13291, 198, 197, 322, 5815, 448, 279, 61044, 8870, 315, 419, 2795, 13313, 11705, 624, 8810, 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, 1...
9
func TestGetDomainState(t *testing.T) { dom, conn := buildTestDomain() defer func() { dom.Free() if res, _ := conn.Close(); res != 0 { t.Errorf("Close() == %d, expected 0", res) } }() state, reason, err := dom.GetState() if err != nil { t.Error(err) return } if state != DOMAIN_SHUTOFF { t.Error("Domain state in test transport should be shutoff") return } if DomainShutoffReason(reason) != DOMAIN_SHUTOFF_UNKNOWN { t.Error("Domain reason in test transport should be unknown") return } }
explode_data.jsonl/64818
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 199 }
[ 2830, 3393, 1949, 13636, 1397, 1155, 353, 8840, 836, 8, 341, 2698, 316, 11, 4534, 1669, 1936, 2271, 13636, 741, 16867, 2915, 368, 341, 197, 2698, 316, 52229, 741, 197, 743, 592, 11, 716, 1669, 4534, 10421, 2129, 592, 961, 220, 15, 3...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestCmdNodeIsRevertible(t *testing.T) { tcases := []struct { line, result string params map[string]interface{} err error revertible bool }{ {line: "update vpc", result: "any", revertible: false}, {line: "delete vpc", result: "any", revertible: false}, {line: "create vpc", result: "any", err: errors.New("any"), revertible: false}, {line: "create vpc", revertible: false}, {line: "start instance", revertible: false}, {line: "create vpc", result: "any", revertible: true}, {line: "stop instance", result: "any", revertible: true}, {line: "attach policy", revertible: true}, {line: "detach policy", revertible: true}, {line: "create record", revertible: true}, {line: "delete record", revertible: true}, {line: "copy image", result: "any", revertible: true}, {line: "detach routetable", revertible: false}, {line: "start alarm", revertible: true}, {line: "stop alarm", revertible: true}, {line: "start containertask", params: map[string]interface{}{"type": "service"}, revertible: true}, {line: "start containertask", params: map[string]interface{}{"type": "task"}, revertible: true}, } for _, tc := range tcases { splits := strings.SplitN(tc.line, " ", 2) action, entity := splits[0], splits[1] cmd := &ast.CommandNode{Action: action, Entity: entity, CmdResult: tc.result, CmdErr: tc.err} if tc.params != nil { cmd.ParamNodes = tc.params } if tc.revertible != isRevertible(cmd) { t.Fatalf("expected '%s' to have revertible=%t", cmd, tc.revertible) } } }
explode_data.jsonl/39587
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 580 }
[ 2830, 3393, 15613, 1955, 3872, 693, 1621, 1238, 1155, 353, 8840, 836, 8, 341, 3244, 23910, 1669, 3056, 1235, 341, 197, 27109, 11, 1102, 914, 198, 197, 25856, 981, 2415, 14032, 31344, 16094, 197, 9859, 688, 1465, 198, 197, 17200, 1621, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestVersion(t *testing.T) { if Version() != "" { t.Errorf("Unexpected version %q, want \"\"", Version()) } var v = "1" SetVersion(v) if Version() != v { t.Errorf("Unexpected version %q, want %q", Version(), v) } }
explode_data.jsonl/4157
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 92 }
[ 2830, 3393, 5637, 1155, 353, 8840, 836, 8, 341, 743, 6079, 368, 961, 1591, 341, 197, 3244, 13080, 445, 29430, 2319, 1018, 80, 11, 1366, 7245, 55853, 6079, 2398, 197, 532, 2405, 348, 284, 330, 16, 698, 22212, 5637, 3747, 340, 743, 60...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestRowsCloseOrder(t *testing.T) { db := newTestDB(t, "people") defer closeDB(t, db) db.SetMaxIdleConns(0) setStrictFakeConnClose(t) defer setStrictFakeConnClose(nil) rows, err := db.Query("SELECT|people|age,name|") if err != nil { t.Fatal(err) } err = rows.Close() if err != nil { t.Fatal(err) } }
explode_data.jsonl/16011
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 144 }
[ 2830, 3393, 9024, 7925, 4431, 1155, 353, 8840, 836, 8, 341, 20939, 1669, 501, 2271, 3506, 1155, 11, 330, 16069, 1138, 16867, 3265, 3506, 1155, 11, 2927, 692, 20939, 4202, 5974, 41370, 1109, 4412, 7, 15, 340, 8196, 41857, 52317, 9701, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestPasswordEntry_Reveal(t *testing.T) { app := test.NewApp() defer test.NewApp() app.Settings().SetTheme(theme.LightTheme()) t.Run("NewPasswordEntry constructor", func(t *testing.T) { entry := widget.NewPasswordEntry() window := test.NewWindow(entry) defer window.Close() window.Resize(fyne.NewSize(150, 100)) entry.Resize(entry.MinSize().Max(fyne.NewSize(130, 0))) entry.Move(fyne.NewPos(10, 10)) c := window.Canvas() test.AssertImageMatches(t, "password_entry/initial.png", c.Capture()) c.Focus(entry) test.Type(entry, "Hié™שרה") assert.Equal(t, "Hié™שרה", entry.Text) test.AssertImageMatches(t, "password_entry/concealed.png", c.Capture()) // update the Password field entry.Password = false entry.Refresh() assert.Equal(t, "Hié™שרה", entry.Text) test.AssertImageMatches(t, "password_entry/revealed.png", c.Capture()) assert.Equal(t, entry, c.Focused()) // update the Password field entry.Password = true entry.Refresh() assert.Equal(t, "Hié™שרה", entry.Text) test.AssertImageMatches(t, "password_entry/concealed.png", c.Capture()) assert.Equal(t, entry, c.Focused()) // tap on action icon tapPos := fyne.NewPos(140-theme.Padding()*2-theme.IconInlineSize()/2, 10+entry.Size().Height/2) test.TapCanvas(c, tapPos) assert.Equal(t, "Hié™שרה", entry.Text) test.AssertImageMatches(t, "password_entry/revealed.png", c.Capture()) assert.Equal(t, entry, c.Focused()) // tap on action icon test.TapCanvas(c, tapPos) assert.Equal(t, "Hié™שרה", entry.Text) test.AssertImageMatches(t, "password_entry/concealed.png", c.Capture()) assert.Equal(t, entry, c.Focused()) }) // This test cover backward compatibility use case when on an Entry widget // the Password field is set to true. // In this case the action item will be set when the renderer is created. t.Run("Entry with Password field", func(t *testing.T) { entry := &widget.Entry{} entry.Password = true entry.Refresh() window := test.NewWindow(entry) defer window.Close() window.Resize(fyne.NewSize(150, 100)) entry.Resize(entry.MinSize().Max(fyne.NewSize(130, 0))) entry.Move(fyne.NewPos(10, 10)) c := window.Canvas() test.AssertImageMatches(t, "password_entry/initial.png", c.Capture()) c.Focus(entry) test.Type(entry, "Hié™שרה") assert.Equal(t, "Hié™שרה", entry.Text) test.AssertImageMatches(t, "password_entry/concealed.png", c.Capture()) // update the Password field entry.Password = false entry.Refresh() assert.Equal(t, "Hié™שרה", entry.Text) test.AssertImageMatches(t, "password_entry/revealed.png", c.Capture()) assert.Equal(t, entry, c.Focused()) }) }
explode_data.jsonl/57339
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1055 }
[ 2830, 3393, 4876, 5874, 50693, 40611, 1155, 353, 8840, 836, 8, 341, 28236, 1669, 1273, 7121, 2164, 741, 16867, 1273, 7121, 2164, 741, 28236, 27000, 1005, 1649, 12594, 57524, 50791, 12594, 12367, 3244, 16708, 445, 3564, 4876, 5874, 4692, 4...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestRuleMultiBytesWord(t *testing.T) { common.Log.Debug("Entering function: %s", common.GetFunctionName()) sqls := [][]string{ { "select col as 列 from tb", "select col as `列` from tb", }, { "select col as c from tb", "select '列'", }, } for _, sql := range sqls[0] { q, err := NewQuery4Audit(sql) if err == nil { rule := q.RuleMultiBytesWord() if rule.Item != "KWR.004" { t.Error("Rule not match:", rule.Item, "Expect : KWR.004") } } else { t.Error("sqlparser.Parse Error:", err) } } for _, sql := range sqls[1] { q, err := NewQuery4Audit(sql) if err == nil { rule := q.RuleMultiBytesWord() if rule.Item != "OK" { t.Error("Rule not match:", rule.Item, "Expect : OK") } } else { t.Error("sqlparser.Parse Error:", err) } } common.Log.Debug("Exiting function: %s", common.GetFunctionName()) }
explode_data.jsonl/76776
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 394 }
[ 2830, 3393, 11337, 20358, 7078, 10879, 1155, 353, 8840, 836, 8, 341, 83825, 5247, 20345, 445, 82867, 729, 25, 1018, 82, 497, 4185, 2234, 5152, 675, 2398, 30633, 82, 1669, 52931, 917, 515, 197, 197, 515, 298, 197, 1, 1742, 1375, 438, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestNewRegistry(t *testing.T) { r := NewRegistry(info.NewRuntimeInfo()) r.Register(NewFactory("mock", func() lock.LockStore { return nil }), ) if _, err := r.Create("mock"); err != nil { t.Fatalf("create mock store failed: %v", err) } if _, err := r.Create("not exists"); !strings.Contains(err.Error(), "not regsitered") { t.Fatalf("create mock store failed: %v", err) } }
explode_data.jsonl/9679
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 151 }
[ 2830, 3393, 3564, 15603, 1155, 353, 8840, 836, 8, 341, 7000, 1669, 1532, 15603, 14208, 7121, 15123, 1731, 2398, 7000, 19983, 35063, 4153, 445, 16712, 497, 2915, 368, 5296, 31403, 6093, 341, 197, 853, 2092, 198, 197, 30793, 197, 340, 743...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 Test_destroyStatefulsets(t *testing.T) { ctx := context.Background() sfs := &appsv1.StatefulSet{ ObjectMeta: metav1.ObjectMeta{ Name: "test", Namespace: "ns", Labels: map[string]string{model.StackNameLabel: "stack-test"}, }, } client := fake.NewSimpleClientset(sfs) var tests = []struct { name string stack *model.Stack expectedDeployments int }{ { name: "not destroy anything", stack: &model.Stack{ Namespace: "ns", Name: "stack-test", Services: map[string]*model.Service{ "test": { Image: "test_image", RestartPolicy: corev1.RestartPolicyAlways, Volumes: []model.StackVolume{ { LocalPath: "/", RemotePath: "/", }, }, }, }, }, expectedDeployments: 1, }, { name: "destroy dep not in stack", stack: &model.Stack{ Namespace: "ns", Name: "stack-test", Services: map[string]*model.Service{ "test-2": { Image: "test_image", RestartPolicy: corev1.RestartPolicyAlways, Volumes: []model.StackVolume{ { LocalPath: "/", RemotePath: "/", }, }, }, }, }, expectedDeployments: 0, }, { name: "destroy dep which is not deployment anymore", stack: &model.Stack{ Namespace: "ns", Name: "stack-test", Services: map[string]*model.Service{ "test": { Image: "test_image", RestartPolicy: corev1.RestartPolicyNever, }, }, }, expectedDeployments: 0, }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { spinner := utils.NewSpinner("testing") err := destroyStatefulsets(ctx, spinner, tt.stack, client) if err != nil { t.Fatal("Not destroyed correctly") } sfsList, err := statefulsets.List(ctx, "ns", tt.stack.GetLabelSelector(), client) if err != nil { t.Fatal("could not retrieve list correctly") } if len(sfsList) != tt.expectedDeployments { t.Fatal("Not destroyed correctly") } }) } }
explode_data.jsonl/22837
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1006 }
[ 2830, 3393, 18066, 1397, 1262, 4917, 1155, 353, 8840, 836, 8, 341, 20985, 1669, 2266, 19047, 2822, 1903, 3848, 1669, 609, 676, 3492, 16, 18942, 1262, 1649, 515, 197, 23816, 12175, 25, 77520, 16, 80222, 515, 298, 21297, 25, 414, 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...
4
func TestShortFlag(t *testing.T) { var args struct { Foo string `arg:"-f"` } err := parse("-f xyz", &args) require.NoError(t, err) assert.Equal(t, "xyz", args.Foo) err = parse("-foo xyz", &args) require.NoError(t, err) assert.Equal(t, "xyz", args.Foo) err = parse("--foo xyz", &args) require.NoError(t, err) assert.Equal(t, "xyz", args.Foo) }
explode_data.jsonl/12994
{ "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, 12472, 12135, 1155, 353, 8840, 836, 8, 341, 2405, 2827, 2036, 341, 197, 12727, 2624, 914, 1565, 858, 86789, 69, 8805, 197, 630, 9859, 1669, 4715, 13645, 69, 40511, 497, 609, 2116, 340, 17957, 35699, 1155, 11, 1848, 340, 69...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestPukRollNewUserEK(t *testing.T) { tc, mctx, user := ephemeralKeyTestSetup(t) defer tc.Cleanup() // Confirm that the user has a userEK. uid := tc.G.Env.GetUID() uids := []keybase1.UID{uid} statements, err := fetchUserEKStatements(mctx, uids) require.NoError(t, err) firstStatement, ok := statements[uid] require.True(t, ok) require.EqualValues(t, firstStatement.CurrentUserEkMetadata.Generation, 1, "should start at userEK gen 1") // Do a PUK roll. rollEngine := engine.NewPerUserKeyRoll(tc.G, &engine.PerUserKeyRollArgs{}) uis := libkb.UIs{ LogUI: tc.G.UI.GetLogUI(), SecretUI: user.NewSecretUI(), } mctx = mctx.WithUIs(uis) err = engine.RunEngine2(mctx, rollEngine) require.NoError(t, err) // Finally, confirm that the roll above also rolled a new userEK. statements, err = fetchUserEKStatements(mctx, uids) require.NoError(t, err) secondStatement, ok := statements[uid] require.True(t, ok) require.EqualValues(t, secondStatement.CurrentUserEkMetadata.Generation, 2, "after PUK roll, should have userEK gen 2") userEK, err := tc.G.GetUserEKBoxStorage().Get(mctx, 2, nil) require.NoError(t, err) require.Equal(t, secondStatement.CurrentUserEkMetadata, userEK.Metadata) // Confirm that we can make a new userEK after rolling the PUK merkleRootPtr, err := tc.G.GetMerkleClient().FetchRootFromServer(mctx, libkb.EphemeralKeyMerkleFreshness) require.NoError(t, err) merkleRoot := *merkleRootPtr publishAndVerifyUserEK(mctx, t, merkleRoot, uid) }
explode_data.jsonl/65198
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 581 }
[ 2830, 3393, 47, 3101, 32355, 3564, 1474, 71133, 1155, 353, 8840, 836, 8, 341, 78255, 11, 296, 3773, 11, 1196, 1669, 82134, 3253, 1592, 2271, 21821, 1155, 340, 16867, 17130, 727, 60639, 2822, 197, 322, 33563, 429, 279, 1196, 702, 264, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestGetDiscoveryMode(t *testing.T) { log.Println("Test GetDiscoveryMode") res, err := testDevice.GetDiscoveryMode() if err != nil { t.Error(err) } fmt.Println(res) }
explode_data.jsonl/60355
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 72 }
[ 2830, 3393, 1949, 67400, 3636, 1155, 353, 8840, 836, 8, 341, 6725, 12419, 445, 2271, 2126, 67400, 3636, 5130, 10202, 11, 1848, 1669, 1273, 6985, 2234, 67400, 3636, 741, 743, 1848, 961, 2092, 341, 197, 3244, 6141, 3964, 340, 197, 630, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestAdd4D(t *testing.T) { ctx := assert.Context(t) for _, test := range []struct { a f32.Vec4 b f32.Vec4 r f32.Vec4 }{ {f32.Vec4{0, 0, 0, 0}, f32.Vec4{0, 0, 0, 0}, f32.Vec4{0, 0, 0, 0}}, {f32.Vec4{1, 2, 3, 4}, f32.Vec4{0, 0, 0, 0}, f32.Vec4{1, 2, 3, 4}}, {f32.Vec4{0, 0, 0, 0}, f32.Vec4{4, 3, 2, 1}, f32.Vec4{4, 3, 2, 1}}, {f32.Vec4{1, 2, 3, 4}, f32.Vec4{-1, -2, -3, -4}, f32.Vec4{0, 0, 0, 0}}, } { assert.For(ctx, "Add4D(%v, %v)", test.a, test.b). That(f32.Add4D(test.a, test.b)).Equals(test.r) } }
explode_data.jsonl/8032
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 336 }
[ 2830, 3393, 2212, 19, 35, 1155, 353, 8840, 836, 8, 341, 20985, 1669, 2060, 9328, 1155, 340, 2023, 8358, 1273, 1669, 2088, 3056, 1235, 341, 197, 11323, 282, 18, 17, 5058, 757, 19, 198, 197, 2233, 282, 18, 17, 5058, 757, 19, 198, 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...
2
func TestVppSetL2XConnect(t *testing.T) { ctx, xcHandler, ifaceIdx := xcTestSetup(t) defer ctx.TeardownTestCtx() ifaceIdx.Put("rxIf1", &ifaceidx.IfaceMetadata{SwIfIndex: 100}) ifaceIdx.Put("rxIf2", &ifaceidx.IfaceMetadata{SwIfIndex: 101}) ifaceIdx.Put("txIf1", &ifaceidx.IfaceMetadata{SwIfIndex: 200}) ifaceIdx.Put("txIf2", &ifaceidx.IfaceMetadata{SwIfIndex: 201}) for i := 0; i < len(inTestDataXConnect); i++ { ctx.MockVpp.MockReply(inTestDataXConnect[i].message) err := xcHandler.AddL2XConnect(inTestDataXConnect[i].receiveIfaceIndex, inTestDataXConnect[i].transmitIfaceIndex) if outTestDataXConnect[i].isResultOk { Expect(err).To(BeNil()) } else { Expect(err).NotTo(BeNil()) } outTestDataXConnect[i].outData.Enable = 1 Expect(ctx.MockChannel.Msg).To(Equal(outTestDataXConnect[i].outData)) } }
explode_data.jsonl/71080
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 371 }
[ 2830, 3393, 53, 602, 1649, 43, 17, 55, 14611, 1155, 353, 8840, 836, 8, 341, 20985, 11, 56901, 3050, 11, 49313, 11420, 1669, 56901, 2271, 21821, 1155, 340, 16867, 5635, 94849, 37496, 2271, 23684, 2822, 743, 578, 11420, 39825, 445, 12651,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestPrincipalRoleMember(t *testing.T) { msp1, err := setup("testdata/idemix/MSP1OU1", "MSP1OU1") assert.NoError(t, err) id1, err := getDefaultSigner(msp1) assert.NoError(t, err) principalBytes, err := proto.Marshal(&msp.MSPRole{Role: msp.MSPRole_MEMBER, MspIdentifier: id1.GetMSPIdentifier()}) assert.NoError(t, err) principal := &msp.MSPPrincipal{ PrincipalClassification: msp.MSPPrincipal_ROLE, Principal: principalBytes} err = id1.SatisfiesPrincipal(principal) assert.NoError(t, err) // Member should also satisfy client principalBytes, err = proto.Marshal(&msp.MSPRole{Role: msp.MSPRole_CLIENT, MspIdentifier: id1.GetMSPIdentifier()}) assert.NoError(t, err) principal = &msp.MSPPrincipal{ PrincipalClassification: msp.MSPPrincipal_ROLE, Principal: principalBytes} err = id1.SatisfiesPrincipal(principal) assert.NoError(t, err) }
explode_data.jsonl/46046
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 379 }
[ 2830, 3393, 31771, 9030, 9366, 1155, 353, 8840, 836, 8, 341, 47691, 79, 16, 11, 1848, 1669, 6505, 445, 92425, 38146, 336, 941, 10270, 4592, 16, 11922, 16, 497, 330, 44, 4592, 16, 11922, 16, 1138, 6948, 35699, 1155, 11, 1848, 692, 15...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestInitWithEC2metadata(t *testing.T) { ctrl, mockMetadata, _ := setup(t) defer ctrl.Finish() mockMetadata.EXPECT().GetMetadata(metadataAZ).Return(az, nil) mockMetadata.EXPECT().GetMetadata(metadataLocalIP).Return(localIP, nil) mockMetadata.EXPECT().GetMetadata(metadataInstanceID).Return(instanceID, nil) mockMetadata.EXPECT().GetMetadata(metadataInstanceType).Return(instanceType, nil) mockMetadata.EXPECT().GetMetadata(metadataMAC).Return(primaryMAC, nil) mockMetadata.EXPECT().GetMetadata(metadataMACPath).Return(primaryMAC, nil) mockMetadata.EXPECT().GetMetadata(metadataMACPath+primaryMAC+metadataDeviceNum).Return("1", nil) mockMetadata.EXPECT().GetMetadata(metadataMACPath+primaryMAC+metadataOwnerID).Return("1234", nil) mockMetadata.EXPECT().GetMetadata(metadataMACPath+primaryMAC+metadataInterface).Return(primaryMAC, nil) mockMetadata.EXPECT().GetMetadata(metadataMACPath+primaryMAC+metadataSGs).Return(sgs, nil) mockMetadata.EXPECT().GetMetadata(metadataMACPath+primaryMAC+metadataSubnetID).Return(subnetID, nil) mockMetadata.EXPECT().GetMetadata(metadataMACPath+primaryMAC+metadataVPCcidr).Return(vpcCIDR, nil) mockMetadata.EXPECT().GetMetadata(metadataMACPath+primaryMAC+metadataVPCcidrs).Return(vpcCIDR, nil) ins := &EC2InstanceMetadataCache{ec2Metadata: mockMetadata} err := ins.initWithEC2Metadata() assert.NoError(t, err) assert.Equal(t, az, ins.availabilityZone) assert.Equal(t, localIP, ins.localIPv4) assert.Equal(t, ins.instanceID, instanceID) assert.Equal(t, ins.primaryENImac, primaryMAC) assert.Equal(t, len(ins.securityGroups), 2) assert.Equal(t, subnetID, ins.subnetID) assert.Equal(t, vpcCIDR, ins.vpcIPv4CIDR) }
explode_data.jsonl/19277
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 603 }
[ 2830, 3393, 3803, 2354, 7498, 17, 17637, 1155, 353, 8840, 836, 8, 341, 84381, 11, 7860, 14610, 11, 716, 1669, 6505, 1155, 340, 16867, 23743, 991, 18176, 2822, 77333, 14610, 22402, 7285, 1005, 1949, 14610, 54436, 23563, 568, 5598, 7, 137...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestForPanicTrace(t *testing.T) { defer func() { if e := recover(); e != nil { PanicTrace(4) //os.Exit(1) } }() panic("just for test") }
explode_data.jsonl/61606
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 74 }
[ 2830, 3393, 2461, 47, 31270, 6550, 1155, 353, 8840, 836, 8, 341, 16867, 2915, 368, 341, 197, 743, 384, 1669, 11731, 2129, 384, 961, 2092, 341, 298, 10025, 31270, 6550, 7, 19, 340, 298, 197, 322, 436, 34358, 7, 16, 340, 197, 197, 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 ]
2
func TestUpdateTicker(t *testing.T) { t.Parallel() cp := currency.NewPairWithDelimiter("BTC", "USDT", "/") _, err := c.UpdateTicker(cp, asset.Spot) if err != nil { t.Error(err) } _, err = c.UpdateTicker(cp, asset.PerpetualSwap) if err != nil { t.Error(err) } }
explode_data.jsonl/42934
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 122 }
[ 2830, 3393, 4289, 87278, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 741, 52018, 1669, 11413, 7121, 12443, 2354, 91098, 445, 59118, 497, 330, 2034, 10599, 497, 3521, 1138, 197, 6878, 1848, 1669, 272, 16689, 87278, 44075, 11, 9329, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestAction_Validate_RequireMixinData(t *testing.T) { c := NewTestConfig(t) c.SetupPorterHome() c.TestContext.AddTestFile("testdata/simple.porter.yaml", Name) err := c.LoadManifest() require.NoError(t, err) // Sabotage! c.Manifest.Install[0].Data = nil err = c.Manifest.Install.Validate(c.Manifest) assert.EqualError(t, err, "no mixin specified") }
explode_data.jsonl/10947
{ "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, 2512, 62, 17926, 62, 17959, 38456, 1043, 1155, 353, 8840, 836, 8, 341, 1444, 1669, 1532, 2271, 2648, 1155, 340, 1444, 39820, 7084, 261, 7623, 2822, 1444, 8787, 1972, 1904, 2271, 1703, 445, 92425, 67195, 14598, 261, 33406, 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...
1
func TestAuthenticatorFlags_HasExtensions(t *testing.T) { var goodByte byte = 0x80 var badByte byte = 0x01 tests := []struct { name string flag AuthenticatorFlags want bool }{ { "Present", AuthenticatorFlags(goodByte), true, }, { "Missing", AuthenticatorFlags(badByte), false, }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { if got := tt.flag.HasExtensions(); got != tt.want { t.Errorf("AuthenticatorFlags.HasExtensions() = %v, want %v", got, tt.want) } }) } }
explode_data.jsonl/78527
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 232 }
[ 2830, 3393, 5087, 61393, 9195, 2039, 300, 31282, 1155, 353, 8840, 836, 8, 341, 2405, 1661, 7153, 4922, 284, 220, 15, 87, 23, 15, 198, 2405, 3873, 7153, 4922, 284, 220, 15, 87, 15, 16, 198, 78216, 1669, 3056, 1235, 341, 197, 11609, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestDeviceClass(t *testing.T) { tests := []struct { features fidlethernet.Features expectClass network.DeviceClass }{ { features: 0, expectClass: network.DeviceClassEthernet, }, { features: fidlethernet.FeaturesWlan, expectClass: network.DeviceClassWlan, }, } for _, test := range tests { c := eth.Client{ Info: fidlethernet.Info{ Features: test.features, }, } if got := c.DeviceClass(); got != test.expectClass { t.Errorf("got c.DeviceClass() = %s, want = %s", got, test.expectClass) } } }
explode_data.jsonl/41338
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 236 }
[ 2830, 3393, 6985, 1957, 1155, 353, 8840, 836, 8, 341, 78216, 1669, 3056, 1235, 341, 197, 1166, 22462, 262, 32104, 273, 696, 4711, 73257, 198, 197, 24952, 1957, 3922, 43995, 1957, 198, 197, 59403, 197, 197, 515, 298, 1166, 22462, 25, 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...
3
func Test_DirectArrayT(t *testing.T) { const ( ddl = ` CREATE TABLE clickhouse_test_direct_array ( int8 Array(Int8), int16 Array(Int16), int32 Array(Int32), int64 Array(Int64), uint8 Array(UInt8), uint16 Array(UInt16), uint32 Array(UInt32), uint64 Array(UInt64), float32 Array(Float32), float64 Array(Float64), string Array(String), fString Array(FixedString(2)), date Array(Date), datetime Array(DateTime), enum8 Array(Enum8 ('a' = 1, 'b' = 2)), enum16 Array(Enum16('c' = 1, 'd' = 2)) ) Engine=Memory ` dml = ` INSERT INTO clickhouse_test_direct_array ( int8, int16, int32, int64, uint8, uint16, uint32, uint64, float32, float64, string, fString, date, datetime, enum8, enum16 ) VALUES ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? ) ` ) if connect, err := clickhouse.Open("tcp://127.0.0.1:9000?debug=true"); assert.NoError(t, err) { { var ( tx, _ = connect.Begin() stmt, _ = connect.Prepare("DROP TABLE clickhouse_test_direct_array") ) stmt.Exec([]driver.Value{}) tx.Commit() } { if tx, err := connect.Begin(); assert.NoError(t, err) { if stmt, err := connect.Prepare(ddl); assert.NoError(t, err) { if _, err := stmt.Exec([]driver.Value{}); assert.NoError(t, err) { assert.NoError(t, tx.Commit()) } } } } { if tx, err := connect.Begin(); assert.NoError(t, err) { if stmt, err := connect.Prepare(dml); assert.NoError(t, err) { for i := 0; i < 100; i++ { _, err := stmt.Exec([]driver.Value{ clickhouse.Array([]int8{1, 2, 3}), clickhouse.Array([]int16{5, 6, 7}), clickhouse.Array([]int32{8, 9, 10}), clickhouse.Array([]int64{11, 12, 13}), clickhouse.Array([]uint8{14, 15, 16}), clickhouse.Array([]uint16{17, 18, 19}), clickhouse.Array([]uint32{20, 21, 22}), clickhouse.Array([]uint64{23, 24, 25}), clickhouse.Array([]float32{32.1, 32.2}), clickhouse.Array([]float64{64.1, 64.2}), clickhouse.Array([]string{fmt.Sprintf("A_%d", i), "B", "C"}), clickhouse.ArrayFixedString(2, []string{"RU", "EN", "DE"}), clickhouse.ArrayDate([]time.Time{time.Now(), time.Now()}), clickhouse.ArrayDateTime([]time.Time{time.Now(), time.Now()}), clickhouse.Array([]string{"a", "b"}), clickhouse.Array([]string{"c", "d"}), }) if !assert.NoError(t, err) { return } } assert.NoError(t, tx.Commit()) } } } } }
explode_data.jsonl/22891
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1427 }
[ 2830, 3393, 1557, 1226, 1857, 51, 1155, 353, 8840, 836, 8, 341, 4777, 2399, 197, 197, 78372, 284, 22074, 298, 6258, 15489, 14363, 4205, 7675, 4452, 32871, 3858, 2399, 571, 2084, 23, 257, 2910, 24123, 23, 1326, 571, 2084, 16, 21, 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...
9
func TestNotificationDelivery(t *testing.T) { // given ds, mockServer := mockDeliveryService(defaultTemplateLoader()) mg := mailgun.NewMailgun("crt-test.com", "123") mg.SetAPIBase(mockServer.URL()) t.Run("test notification delivery ok", func(t *testing.T) { // given userSignup := &toolchainv1alpha1.UserSignup{ ObjectMeta: newObjectMeta("abc123", "foo@redhat.com"), Spec: toolchainv1alpha1.UserSignupSpec{ Username: "foo@redhat.com", Userid: "foo", GivenName: "Foo", FamilyName: "Bar", Company: "Red Hat", }, } controller, client := newController(t, ds, userSignup) notification, err := NewNotificationBuilder(client, test.HostOperatorNs). WithUserContext(userSignup). WithSubjectAndContent("foo", "test content"). Create("foo@redhat.com") require.NoError(t, err) // when result, err := reconcileNotification(controller, notification) // then require.NoError(t, err) require.True(t, result.Requeue) // Load the reconciled notification key := types.NamespacedName{ Namespace: test.HostOperatorNs, Name: notification.Name, } instance := &toolchainv1alpha1.Notification{} err = client.Get(context.TODO(), key, instance) require.NoError(t, err) test.AssertConditionsMatch(t, instance.Status.Conditions, toolchainv1alpha1.Condition{ Type: toolchainv1alpha1.NotificationSent, Status: corev1.ConditionTrue, Reason: toolchainv1alpha1.NotificationSentReason, }, ) iter := mg.ListEvents(&mailgun.ListEventOptions{Limit: 1}) var events []mailgun.Event require.True(t, iter.First(context.Background(), &events)) require.True(t, iter.Last(context.Background(), &events)) require.Len(t, events, 1) e := events[0] require.IsType(t, &events2.Accepted{}, e) accepted := e.(*events2.Accepted) require.Equal(t, "foo@redhat.com", accepted.Recipient) require.Equal(t, "redhat.com", accepted.RecipientDomain) require.Equal(t, "foo", accepted.Message.Headers.Subject) require.Equal(t, "noreply@foo.com", accepted.Message.Headers.From) }) t.Run("test admin notification delivery ok", func(t *testing.T) { // given controller, client := newController(t, ds) notification, err := NewNotificationBuilder(client, test.HostOperatorNs). WithSubjectAndContent("Alert", "Something bad happened"). Create("sandbox-admin@developers.redhat.com") require.NoError(t, err) // when result, err := reconcileNotification(controller, notification) // then require.NoError(t, err) require.True(t, result.Requeue) // Load the reconciled notification key := types.NamespacedName{ Namespace: test.HostOperatorNs, Name: notification.Name, } instance := &toolchainv1alpha1.Notification{} err = client.Get(context.TODO(), key, instance) require.NoError(t, err) test.AssertConditionsMatch(t, instance.Status.Conditions, toolchainv1alpha1.Condition{ Type: toolchainv1alpha1.NotificationSent, Status: corev1.ConditionTrue, Reason: toolchainv1alpha1.NotificationSentReason, }, ) iter := mg.ListEvents(&mailgun.ListEventOptions{Limit: 1}) var events []mailgun.Event require.True(t, iter.First(context.Background(), &events)) require.True(t, iter.Last(context.Background(), &events)) require.Len(t, events, 1) e := events[0] require.IsType(t, &events2.Accepted{}, e) accepted := e.(*events2.Accepted) require.Equal(t, "sandbox-admin@developers.redhat.com", accepted.Recipient) require.Equal(t, "developers.redhat.com", accepted.RecipientDomain) require.Equal(t, "Alert", accepted.Message.Headers.Subject) require.Equal(t, "noreply@foo.com", accepted.Message.Headers.From) }) t.Run("test notification with environment e2e", func(t *testing.T) { // given toolchainConfig := commonconfig.NewToolchainConfigObjWithReset(t, testconfig.Environment(testconfig.E2E)) userSignup := &toolchainv1alpha1.UserSignup{ ObjectMeta: newObjectMeta("abc123", "jane@redhat.com"), Spec: toolchainv1alpha1.UserSignupSpec{ Username: "jane@redhat.com", GivenName: "jane", FamilyName: "doe", Company: "Red Hat", }, } // pass in nil for deliveryService since send won't be used (sending skipped) controller, client := newController(t, nil, userSignup, toolchainConfig) notification, err := NewNotificationBuilder(client, test.HostOperatorNs). Create("jane@redhat.com") require.NoError(t, err) // when result, err := reconcileNotification(controller, notification) // then require.NoError(t, err) require.True(t, result.Requeue) // Load the reconciled notification key := types.NamespacedName{ Namespace: test.HostOperatorNs, Name: notification.Name, } instance := &toolchainv1alpha1.Notification{} err = client.Get(context.TODO(), key, instance) require.NoError(t, err) ntest.AssertThatNotification(t, instance.Name, client). HasConditions(sentCond()) }) t.Run("test notification delivery fails for delivery service failure", func(t *testing.T) { // given userSignup := &toolchainv1alpha1.UserSignup{ ObjectMeta: newObjectMeta("abc123", "foo@redhat.com"), Spec: toolchainv1alpha1.UserSignupSpec{ Username: "foo@redhat.com", GivenName: "Foo", FamilyName: "Bar", Company: "Red Hat", }, } mds := &MockDeliveryService{} controller, client := newController(t, mds, userSignup) notification, err := NewNotificationBuilder(client, test.HostOperatorNs). Create("foo@redhat.com") require.NoError(t, err) // when result, err := reconcileNotification(controller, notification) // then require.Error(t, err) require.False(t, result.Requeue) require.Equal(t, "failed to send notification: delivery error", err.Error()) // Load the reconciled notification key := types.NamespacedName{ Namespace: test.HostOperatorNs, Name: notification.Name, } instance := &toolchainv1alpha1.Notification{} err = client.Get(context.TODO(), key, instance) require.NoError(t, err) ntest.AssertThatNotification(t, instance.Name, client). HasConditions(deliveryErrorCond("delivery error")) }) }
explode_data.jsonl/33135
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 2303 }
[ 2830, 3393, 11196, 38121, 1155, 353, 8840, 836, 8, 341, 197, 322, 2661, 198, 83336, 11, 7860, 5475, 1669, 7860, 38121, 1860, 18978, 7275, 9181, 12367, 2109, 70, 1669, 8072, 13259, 7121, 16702, 13259, 445, 66, 3342, 16839, 905, 497, 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 TestGetAllCaptureLeases(t *testing.T) { s := &etcdTester{} s.setUpTest(t) defer s.tearDownTest(t) ctx, cancel := context.WithCancel(context.Background()) defer cancel() testCases := []*model.CaptureInfo{ { ID: "a3f41a6a-3c31-44f4-aa27-344c1b8cd658", AdvertiseAddr: "127.0.0.1:8301", }, { ID: "cdb041d9-ccdd-480d-9975-e97d7adb1185", AdvertiseAddr: "127.0.0.1:8302", }, { ID: "e05e5d34-96ea-44af-812d-ca72aa19e1e5", AdvertiseAddr: "127.0.0.1:8303", }, } leases := make(map[string]int64) for _, cinfo := range testCases { sess, err := concurrency.NewSession(s.client.Client.Unwrap(), concurrency.WithTTL(10), concurrency.WithContext(ctx)) require.NoError(t, err) err = s.client.PutCaptureInfo(ctx, cinfo, sess.Lease()) require.NoError(t, err) leases[cinfo.ID] = int64(sess.Lease()) } _, captures, err := s.client.GetCaptures(ctx) require.NoError(t, err) require.Len(t, captures, len(testCases)) sort.Sort(Captures(captures)) require.Equal(t, captures, testCases) queryLeases, err := s.client.GetCaptureLeases(ctx) require.NoError(t, err) require.Equal(t, queryLeases, leases) // make sure the RevokeAllLeases function can ignore the lease not exist leases["/fake/capture/info"] = 200 err = s.client.RevokeAllLeases(ctx, leases) require.NoError(t, err) queryLeases, err = s.client.GetCaptureLeases(ctx) require.NoError(t, err) require.Equal(t, queryLeases, map[string]int64{}) }
explode_data.jsonl/70535
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 680 }
[ 2830, 3393, 1949, 2403, 27429, 2304, 2264, 1155, 353, 8840, 836, 8, 341, 1903, 1669, 609, 295, 4385, 58699, 16094, 1903, 77700, 2271, 1155, 340, 16867, 274, 31853, 59342, 2271, 1155, 692, 20985, 11, 9121, 1669, 2266, 26124, 9269, 5378, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestExtensionInvalid(t *testing.T) { compression := Compression(-1) output := compression.Extension() if output != "" { t.Fatalf("The extension of an invalid compression should be an empty string.") } }
explode_data.jsonl/79227
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 64 }
[ 2830, 3393, 12049, 7928, 1155, 353, 8840, 836, 8, 341, 32810, 4011, 1669, 66161, 4080, 16, 340, 21170, 1669, 25111, 59715, 741, 743, 2550, 961, 1591, 341, 197, 3244, 30762, 445, 785, 8894, 315, 458, 8318, 25111, 1265, 387, 458, 4287, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestState_UpdateRplNamereply(t *testing.T) { t.Parallel() st := setupNewState() ev := &irc.Event{ Name: irc.RPL_NAMREPLY, Sender: network, Args: []string{ st.selfUser.Nick(), "=", channels[0], "@" + nicks[0] + " +" + nicks[1] + " " + st.selfUser.Nick(), }, } st.addChannel(channels[0]) if got, ok := st.UserModes(users[0], channels[0]); ok { t.Errorf("Expected: %v to be nil.", got) } if got, ok := st.UserModes(users[1], channels[0]); ok { t.Errorf("Expected: %v to be nil.", got) } if got, ok := st.UserModes(st.selfUser.Nick(), channels[0]); ok { t.Errorf("Expected: %v to be nil.", got) } st.Update(ev) got, _ := st.UserModes(users[0], channels[0]) if got.String() != "o" { t.Errorf(`Expected: "o", got: %q`, got.String()) } got, _ = st.UserModes(users[1], channels[0]) if got.String() != "v" { t.Errorf(`Expected: "v", got: %q`, got.String()) } got, _ = st.UserModes(st.selfUser.Nick(), channels[0]) if len(got.String()) > 0 { t.Errorf(`Expected: empty string, got: %q`, got.String()) } }
explode_data.jsonl/32110
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 475 }
[ 2830, 3393, 1397, 47393, 49, 500, 71367, 485, 2541, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 2822, 18388, 1669, 6505, 3564, 1397, 2822, 74837, 1669, 609, 2437, 6904, 515, 197, 21297, 25, 256, 79923, 2013, 2916, 1604, 1402, 787, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestBaseIdentity_GetAttack(t *testing.T) { i := getTestBaseIdentity() a := i.GetAttack() if a != 0 { t.Errorf("When isHero is false, GetAttack should return 0. Expected 0, got: %d", a) } i.ChangeForm() a = i.GetAttack() if a != TestAttack { t.Errorf("When isHero is true, GetAttack should return the hero's attack. Expected %d, got %d", TestAttack, a) } }
explode_data.jsonl/55787
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 144 }
[ 2830, 3393, 3978, 18558, 13614, 28602, 1155, 353, 8840, 836, 8, 341, 8230, 1669, 633, 2271, 3978, 18558, 2822, 11323, 1669, 600, 2234, 28602, 741, 743, 264, 961, 220, 15, 341, 197, 3244, 13080, 445, 4498, 374, 30228, 374, 895, 11, 212...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestMaxRetransmitsTimeout(t *testing.T) { c := context.New(t, defaultMTU) defer c.Cleanup() const numRetries = 2 opt := tcpip.TCPMaxRetriesOption(numRetries) if err := c.Stack().SetTransportProtocolOption(tcp.ProtocolNumber, &opt); err != nil { t.Fatalf("SetTransportProtocolOption(%d, &%T(%d)): %s", tcp.ProtocolNumber, opt, opt, err) } c.CreateConnected(context.TestInitialSequenceNumber, 30000 /* rcvWnd */, -1 /* epRcvBuf */) waitEntry, notifyCh := waiter.NewChannelEntry(nil) c.WQ.EventRegister(&waitEntry, waiter.EventHUp) defer c.WQ.EventUnregister(&waitEntry) var r bytes.Reader r.Reset(make([]byte, 1)) _, err := c.EP.Write(&r, tcpip.WriteOptions{}) if err != nil { t.Fatalf("Write failed: %s", err) } // Expect first transmit and MaxRetries retransmits. for i := 0; i < numRetries+1; i++ { checker.IPv4(t, c.GetPacket(), checker.TCP( checker.DstPort(context.TestPort), checker.TCPFlags(header.TCPFlagAck|header.TCPFlagPsh), ), ) } // Wait for the connection to timeout after MaxRetries retransmits. initRTO := 1 * time.Second select { case <-notifyCh: case <-time.After((2 << numRetries) * initRTO): t.Fatalf("connection still alive after maximum retransmits.\n") } // Send an ACK and expect a RST as the connection would have been closed. c.SendPacket(nil, &context.Headers{ SrcPort: context.TestPort, DstPort: c.Port, Flags: header.TCPFlagAck, }) checker.IPv4(t, c.GetPacket(), checker.TCP( checker.DstPort(context.TestPort), checker.TCPFlags(header.TCPFlagRst), ), ) if got := c.Stack().Stats().TCP.EstablishedTimedout.Value(); got != 1 { t.Errorf("got c.Stack().Stats().TCP.EstablishedTimedout.Value() = %d, want = 1", got) } if got := c.Stack().Stats().TCP.CurrentConnected.Value(); got != 0 { t.Errorf("got stats.TCP.CurrentConnected.Value() = %d, want = 0", got) } }
explode_data.jsonl/75977
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 760 }
[ 2830, 3393, 5974, 12020, 33389, 44703, 7636, 1155, 353, 8840, 836, 8, 341, 1444, 1669, 2266, 7121, 1155, 11, 1638, 8505, 52, 340, 16867, 272, 727, 60639, 2822, 4777, 1629, 12020, 4019, 284, 220, 17, 198, 64838, 1669, 28051, 573, 836, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestFlexLayout(t *testing.T) { fl := flexlayout.New() section1 := fl.AddSection() t1 := component.NewText("item 1") t2 := component.NewText("item 2") t3 := component.NewText("item 3") require.NoError(t, section1.Add(t1, 12)) require.NoError(t, section1.Add(t2, 12)) require.NoError(t, section1.Add(t3, 12)) section2 := fl.AddSection() t4 := component.NewText("item 4") t5 := component.NewText("item 4") require.NoError(t, section2.Add(t4, 6)) require.NoError(t, section2.Add(t5, 6)) got := fl.ToComponent("Title") expected := component.NewFlexLayout("Title") expected.AddSections([]component.FlexLayoutSection{ { component.FlexLayoutItem{Width: 12, View: t1}, component.FlexLayoutItem{Width: 12, View: t2}, component.FlexLayoutItem{Width: 12, View: t3}, }, { component.FlexLayoutItem{Width: 6, View: t4}, component.FlexLayoutItem{Width: 6, View: t5}, }, }...) assert.Equal(t, expected, got) }
explode_data.jsonl/26078
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 379 }
[ 2830, 3393, 31671, 2175, 1155, 353, 8840, 836, 8, 341, 1166, 75, 1669, 5763, 8399, 7121, 2822, 197, 2809, 16, 1669, 1320, 1904, 9620, 2822, 3244, 16, 1669, 3692, 7121, 1178, 445, 1203, 220, 16, 1138, 3244, 17, 1669, 3692, 7121, 1178, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestNetNative(t *testing.T) { log := logging.NewDefaultLoggerFactory().NewLogger("test") t.Run("Interfaces", func(t *testing.T) { nw := NewNet(nil) assert.False(t, nw.IsVirtual(), "should be false") interfaces, err := nw.Interfaces() assert.NoError(t, err, "should succeed") log.Debugf("interfaces: %+v", interfaces) for _, ifc := range interfaces { if ifc.Name == lo0String { _, err := ifc.Addrs() assert.NoError(t, err, "should succeed") } if addrs, err := ifc.Addrs(); err == nil { for _, addr := range addrs { log.Debugf("[%d] %s:%s", ifc.Index, addr.Network(), addr.String()) } } } }) t.Run("ResolveUDPAddr", func(t *testing.T) { nw := NewNet(nil) udpAddr, err := nw.ResolveUDPAddr(udpString, "localhost:1234") if !assert.NoError(t, err, "should succeed") { return } assert.Contains(t, []string{"127.0.0.1", "127.0.1.1"}, udpAddr.IP.String(), "should match") assert.Equal(t, 1234, udpAddr.Port, "should match") }) t.Run("ListenPacket", func(t *testing.T) { nw := NewNet(nil) conn, err := nw.ListenPacket(udpString, "127.0.0.1:0") if !assert.NoError(t, err, "should succeed") { return } udpConn, ok := conn.(*net.UDPConn) assert.True(t, ok, "should succeed") log.Debugf("udpConn: %+v", udpConn) laddr := conn.LocalAddr().String() log.Debugf("laddr: %s", laddr) }) t.Run("ListenUDP random port", func(t *testing.T) { nw := NewNet(nil) srcAddr := &net.UDPAddr{ IP: net.ParseIP("127.0.0.1"), } conn, err := nw.ListenUDP(udpString, srcAddr) assert.NoError(t, err, "should succeed") laddr := conn.LocalAddr().String() log.Debugf("laddr: %s", laddr) assert.NoError(t, conn.Close(), "should succeed") }) t.Run("Dial (UDP)", func(t *testing.T) { nw := NewNet(nil) conn, err := nw.Dial(udpString, "127.0.0.1:1234") assert.NoError(t, err, "should succeed") laddr := conn.LocalAddr() log.Debugf("laddr: %s", laddr.String()) raddr := conn.RemoteAddr() log.Debugf("raddr: %s", raddr.String()) assert.Equal(t, "127.0.0.1", laddr.(*net.UDPAddr).IP.String(), "should match") //nolint:forcetypeassert assert.True(t, laddr.(*net.UDPAddr).Port != 0, "should match") //nolint:forcetypeassert assert.Equal(t, "127.0.0.1:1234", raddr.String(), "should match") assert.NoError(t, conn.Close(), "should succeed") }) t.Run("DialUDP", func(t *testing.T) { nw := NewNet(nil) locAddr := &net.UDPAddr{ IP: net.IPv4(127, 0, 0, 1), Port: 0, } remAddr := &net.UDPAddr{ IP: net.IPv4(127, 0, 0, 1), Port: 1234, } conn, err := nw.DialUDP(udpString, locAddr, remAddr) assert.NoError(t, err, "should succeed") laddr := conn.LocalAddr() log.Debugf("laddr: %s", laddr.String()) raddr := conn.RemoteAddr() log.Debugf("raddr: %s", raddr.String()) assert.Equal(t, "127.0.0.1", laddr.(*net.UDPAddr).IP.String(), "should match") //nolint:forcetypeassert assert.True(t, laddr.(*net.UDPAddr).Port != 0, "should match") //nolint:forcetypeassert assert.Equal(t, "127.0.0.1:1234", raddr.String(), "should match") assert.NoError(t, conn.Close(), "should succeed") }) t.Run("UDPLoopback", func(t *testing.T) { nw := NewNet(nil) conn, err := nw.ListenPacket(udpString, "127.0.0.1:0") assert.NoError(t, err, "should succeed") laddr := conn.LocalAddr() msg := "PING!" n, err := conn.WriteTo([]byte(msg), laddr) assert.NoError(t, err, "should succeed") assert.Equal(t, len(msg), n, "should match") buf := make([]byte, 1000) n, addr, err := conn.ReadFrom(buf) assert.NoError(t, err, "should succeed") assert.Equal(t, len(msg), n, "should match") assert.Equal(t, msg, string(buf[:n]), "should match") assert.Equal(t, laddr.(*net.UDPAddr).String(), addr.(*net.UDPAddr).String(), "should match") //nolint:forcetypeassert assert.NoError(t, conn.Close(), "should succeed") }) t.Run("Dialer", func(t *testing.T) { nw := NewNet(nil) dialer := nw.CreateDialer(&net.Dialer{ LocalAddr: &net.UDPAddr{ IP: net.ParseIP("127.0.0.1"), Port: 0, }, }) conn, err := dialer.Dial(udpString, "127.0.0.1:1234") assert.NoError(t, err, "should succeed") laddr := conn.LocalAddr() log.Debugf("laddr: %s", laddr.String()) raddr := conn.RemoteAddr() log.Debugf("raddr: %s", raddr.String()) assert.Equal(t, "127.0.0.1", laddr.(*net.UDPAddr).IP.String(), "should match") //nolint:forcetypeassert assert.True(t, laddr.(*net.UDPAddr).Port != 0, "should match") //nolint:forcetypeassert assert.Equal(t, "127.0.0.1:1234", raddr.String(), "should match") assert.NoError(t, conn.Close(), "should succeed") }) t.Run("Unexpected operations", func(t *testing.T) { // For portability of test, find a name of loopack interface name first var loName string ifs, err := net.Interfaces() assert.NoError(t, err, "should succeed") for _, ifc := range ifs { if ifc.Flags&net.FlagLoopback != 0 { loName = ifc.Name break } } nw := NewNet(nil) if len(loName) > 0 { // InterfaceByName ifc, err2 := nw.InterfaceByName(loName) assert.NoError(t, err2, "should succeed") assert.Equal(t, loName, ifc.Name, "should match") // getInterface _, err2 = nw.getInterface(loName) assert.Error(t, err2, "should fail") } _, err = nw.InterfaceByName("foo0") assert.Error(t, err, "should fail") // setRouter err = nw.setRouter(nil) assert.Error(t, err, "should fail") // onInboundChunk (shouldn't crash) nw.onInboundChunk(nil) // getStaticIPs ips := nw.getStaticIPs() assert.Nil(t, ips, "should be nil") }) }
explode_data.jsonl/62495
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 2546 }
[ 2830, 3393, 6954, 20800, 1155, 353, 8840, 836, 8, 341, 6725, 1669, 8392, 7121, 3675, 7395, 4153, 1005, 3564, 7395, 445, 1944, 5130, 3244, 16708, 445, 41066, 497, 2915, 1155, 353, 8840, 836, 8, 341, 197, 9038, 86, 1669, 1532, 6954, 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...
5
func TestAPISelector_SelectDefaultWhenBadResponse(t *testing.T) { ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) { w.WriteHeader(http.StatusInternalServerError) })) defer ts.Close() u, _ := url.Parse(ts.URL) as := NewAPISelector(u) as.SetMaxInterval(time.Millisecond) as.SetMaxElapsedTime(10 * time.Millisecond) actual, err := as.Select(context.TODO(), &Params{}) assert.Equal(t, actual, "default") assert.EqualError(t, err, "expected 200 status code from job-board, received status=500 body=\"\"") }
explode_data.jsonl/18680
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 206 }
[ 2830, 3393, 7082, 5877, 58073, 3675, 4498, 17082, 2582, 1155, 353, 8840, 836, 8, 341, 57441, 1669, 54320, 70334, 7121, 5475, 19886, 89164, 18552, 3622, 1758, 37508, 11, 4232, 353, 1254, 9659, 8, 341, 197, 6692, 69794, 19886, 66760, 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...
1
func TestAND(t *testing.T) { fmt.Println("===== AND =====") var a1 = AND(AND(SQL("a=?", 10), SQL("b=?", 20)), AND(SQL("c=?", 30), SQL("d=?", 40))) a1.Append("e=?", 50) a1.Append(AND(SQL("f=?", 60))) fmt.Println(a1.ToSQL()) var a2 = AND(OR(SQL("a=?", 10), SQL("b=?", 20))) fmt.Println(a2.ToSQL()) }
explode_data.jsonl/1260
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 148 }
[ 2830, 3393, 3976, 1155, 353, 8840, 836, 8, 341, 11009, 12419, 445, 46725, 3567, 30742, 1138, 2405, 264, 16, 284, 3567, 7, 3976, 38669, 445, 64, 87873, 220, 16, 15, 701, 7870, 445, 65, 87873, 220, 17, 15, 5731, 3567, 38669, 445, 66, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestDyn_errorOrValue(t *testing.T) { e := errors.New("an error") val := "value" assert.Equal(t, e, errorOrValue(e, val)) assert.Equal(t, val, errorOrValue(nil, val)) }
explode_data.jsonl/9814
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 74 }
[ 2830, 3393, 95709, 4096, 2195, 1130, 1155, 353, 8840, 836, 8, 341, 7727, 1669, 5975, 7121, 445, 276, 1465, 1138, 19302, 1669, 330, 957, 698, 6948, 12808, 1155, 11, 384, 11, 1465, 2195, 1130, 2026, 11, 1044, 1171, 6948, 12808, 1155, 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
func TestFetchOrderHistory(t *testing.T) { t.Parallel() if !areTestAPIKeysSet() { t.Skip() } _, err := f.FetchOrderHistory(context.Background(), "", time.Time{}, time.Time{}, "2") if err != nil { t.Error(err) } _, err = f.FetchOrderHistory(context.Background(), spotPair, time.Unix(authStartTime, 0), time.Unix(authEndTime, 0), "2") if err != nil { t.Error(err) } _, err = f.FetchOrderHistory(context.Background(), spotPair, time.Unix(authEndTime, 0), time.Unix(authStartTime, 0), "2") if err != errStartTimeCannotBeAfterEndTime { t.Errorf("should have thrown errStartTimeCannotBeAfterEndTime, got %v", err) } }
explode_data.jsonl/15185
{ "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, 20714, 4431, 13424, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 741, 743, 753, 546, 2271, 7082, 8850, 1649, 368, 341, 197, 3244, 57776, 741, 197, 532, 197, 6878, 1848, 1669, 282, 78506, 4431, 13424, 5378, 19047, 3148, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestGenerateRequestBodyTypes(t *testing.T) { spec := `--- components: requestBodies: FooRequest: description: bar content: application/json: schema: type: object properties: baz: type: string ` doc, err := openapi.Load([]byte(spec)) if err != nil { t.Fatal(err) } typ, err := generator.GenerateRequestBodyTypes(doc) if err != nil { t.Error(err) return } expected := `package models // code generated by restgen. DO NOT EDIT. // bar type FooRequestBody struct { Baz string } ` if string(typ) != expected { t.Errorf("%s != %s", string(typ), expected) return } }
explode_data.jsonl/65729
{ "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, 31115, 33334, 4173, 1155, 353, 8840, 836, 8, 341, 98100, 1669, 1565, 10952, 5149, 510, 220, 1681, 33, 10028, 510, 262, 33428, 1900, 510, 414, 4008, 25, 3619, 198, 414, 2213, 510, 286, 3766, 8931, 510, 688, 10802, 510, 310,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestFieldIterFromSegmentsDeduplicates(t *testing.T) { segments := []segmentMetadata{ {segment: newTestSegmentWithDocs(t, []doc.Document{ { ID: []byte("foo"), Fields: []doc.Field{ {Name: []byte("fruit"), Value: []byte("apple")}, {Name: []byte("vegetable"), Value: []byte("carrot")}, }, }, })}, {segment: newTestSegmentWithDocs(t, []doc.Document{ { ID: []byte("bar"), Fields: []doc.Field{ {Name: []byte("fruit"), Value: []byte("banana")}, {Name: []byte("meat"), Value: []byte("beef")}, }, }, { ID: []byte("baz"), Fields: []doc.Field{ {Name: []byte("color"), Value: []byte("blue")}, {Name: []byte("alpha"), Value: []byte("1.0")}, }, }, })}, } iter, err := newFieldIterFromSegments(segments) require.NoError(t, err) assertIterValues(t, iter, []string{ string(doc.IDReservedFieldName), "alpha", "color", "fruit", "meat", "vegetable", }) }
explode_data.jsonl/36428
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 440 }
[ 2830, 3393, 1877, 8537, 3830, 64813, 35, 291, 40614, 1155, 353, 8840, 836, 8, 341, 197, 56829, 1669, 3056, 23169, 14610, 515, 197, 197, 90, 23169, 25, 501, 2271, 21086, 2354, 63107, 1155, 11, 3056, 5236, 26256, 515, 298, 197, 515, 571...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestValidateSubpathMutuallyExclusive(t *testing.T) { // Enable feature VolumeSubpathEnvExpansion and VolumeSubpath defer featuregatetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, features.VolumeSubpathEnvExpansion, true)() defer featuregatetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, features.VolumeSubpath, true)() volumes := []core.Volume{ {Name: "abc", VolumeSource: core.VolumeSource{PersistentVolumeClaim: &core.PersistentVolumeClaimVolumeSource{ClaimName: "testclaim1"}}}, {Name: "abc-123", VolumeSource: core.VolumeSource{PersistentVolumeClaim: &core.PersistentVolumeClaimVolumeSource{ClaimName: "testclaim2"}}}, {Name: "123", VolumeSource: core.VolumeSource{HostPath: &core.HostPathVolumeSource{Path: "/foo/baz", Type: newHostPathType(string(core.HostPathUnset))}}}, } vols, v1err := ValidateVolumes(volumes, field.NewPath("field")) if len(v1err) > 0 { t.Errorf("Invalid test volume - expected success %v", v1err) return } container := core.Container{ SecurityContext: nil, } goodVolumeDevices := []core.VolumeDevice{ {Name: "xyz", DevicePath: "/foofoo"}, {Name: "uvw", DevicePath: "/foofoo/share/test"}, } cases := map[string]struct { mounts []core.VolumeMount expectError bool }{ "subpath and subpathexpr not specified": { []core.VolumeMount{ { Name: "abc-123", MountPath: "/bab", }, }, false, }, "subpath expr specified": { []core.VolumeMount{ { Name: "abc-123", MountPath: "/bab", SubPathExpr: "$(POD_NAME)", }, }, false, }, "subpath specified": { []core.VolumeMount{ { Name: "abc-123", MountPath: "/bab", SubPath: "baz", }, }, false, }, "subpath and subpathexpr specified": { []core.VolumeMount{ { Name: "abc-123", MountPath: "/bab", SubPath: "baz", SubPathExpr: "$(POD_NAME)", }, }, true, }, } for name, test := range cases { errs := ValidateVolumeMounts(test.mounts, GetVolumeDeviceMap(goodVolumeDevices), vols, &container, field.NewPath("field")) if len(errs) != 0 && !test.expectError { t.Errorf("test %v failed: %+v", name, errs) } if len(errs) == 0 && test.expectError { t.Errorf("test %v failed, expected error", name) } } }
explode_data.jsonl/25643
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 972 }
[ 2830, 3393, 17926, 3136, 2343, 51440, 1832, 70405, 1155, 353, 8840, 836, 8, 341, 197, 322, 18567, 4565, 20265, 3136, 2343, 14359, 71642, 323, 20265, 3136, 2343, 198, 16867, 4565, 70, 266, 57824, 287, 4202, 13859, 42318, 16014, 2271, 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...
7
func TestEncoder_Result(t *testing.T) { testCases := []struct { Name string E *encoder Expected []*layerJSON }{ { Name: "nil encoder", E: nil, Expected: nil, }, { Name: "success", E: &encoder{ res: []*layerJSON{ { ID: "xxx", PluginID: nil, ExtensionID: nil, Name: "aaa", Property: nil, Infobox: nil, }, }, }, Expected: []*layerJSON{ { ID: "xxx", PluginID: nil, ExtensionID: nil, Name: "aaa", Property: nil, Infobox: nil, }, }, }, } for _, tc := range testCases { tc := tc t.Run(tc.Name, func(tt *testing.T) { tt.Parallel() res := tc.E.Result() assert.Equal(tt, tc.Expected, res) }) } }
explode_data.jsonl/56397
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 479 }
[ 2830, 3393, 19921, 49596, 1155, 353, 8840, 836, 8, 341, 18185, 37302, 1669, 3056, 1235, 341, 197, 21297, 257, 914, 198, 197, 22784, 286, 353, 27008, 198, 197, 197, 18896, 29838, 10333, 5370, 198, 197, 59403, 197, 197, 515, 298, 21297, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestParsePositionalAndMultipleInterspersedKeyword(t *testing.T) { args := []string{"--bar", "puerto rico", "--baz", "colombia", "--bar", "venezuela", "--baz", "honduras", "--baz", "guyana", "and", "still"} f := NewFixture(t, model.NewUserConfigState(args)) defer f.TearDown() f.File("Tiltfile", ` config.define_string_list('foo', args=True) config.define_string_list('bar') config.define_string_list('baz') cfg = config.parse() print("foo:", cfg['foo']) print("bar:", cfg['bar']) print("baz:", cfg['baz']) `) _, err := f.ExecFile("Tiltfile") require.NoError(t, err) require.Contains(t, f.PrintOutput(), `foo: ["and", "still"]`) require.Contains(t, f.PrintOutput(), `bar: ["puerto rico", "venezuela"]`) require.Contains(t, f.PrintOutput(), `baz: ["colombia", "honduras", "guyana"]`) }
explode_data.jsonl/65227
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 327 }
[ 2830, 3393, 14463, 3812, 278, 3036, 32089, 1072, 388, 31290, 291, 34481, 1155, 353, 8840, 836, 8, 341, 31215, 1669, 3056, 917, 4913, 313, 2257, 497, 330, 5584, 13878, 93598, 497, 14482, 42573, 497, 330, 2074, 2855, 685, 497, 14482, 2257...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 Test_ScanDirFile(t *testing.T) { teatPath := gdebug.TestDataPath() gtest.C(t, func(t *gtest.T) { files, err := gfile.ScanDirFile(teatPath, "*", false) t.Assert(err, nil) t.Assert(len(files), 0) }) gtest.C(t, func(t *gtest.T) { files, err := gfile.ScanDirFile(teatPath, "*", true) t.Assert(err, nil) t.AssertNI(teatPath+gfile.Separator+"dir1", files) t.AssertNI(teatPath+gfile.Separator+"dir2", files) t.AssertIN(teatPath+gfile.Separator+"dir1"+gfile.Separator+"file1", files) t.AssertIN(teatPath+gfile.Separator+"dir2"+gfile.Separator+"file2", files) }) }
explode_data.jsonl/25085
{ "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, 1098, 4814, 6184, 1703, 1155, 353, 8840, 836, 8, 341, 197, 665, 266, 1820, 1669, 342, 8349, 8787, 1043, 1820, 741, 3174, 1944, 727, 1155, 11, 2915, 1155, 353, 82038, 836, 8, 341, 197, 74075, 11, 1848, 1669, 342, 1192, 54...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestHeapSortAscending(t *testing.T) { var heap = []int{0, 10, 5, 20, 4, 3, 1, 15} want := []int{0, 1, 3, 4, 5, 10, 15, 20} heapSortAscending(&heap, len(heap)-1) if !reflect.DeepEqual(want, heap) { t.Errorf("after sorting using max heapify wanted %v got %v", want, heap) } }
explode_data.jsonl/22507
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 127 }
[ 2830, 3393, 27909, 10231, 82952, 1155, 353, 8840, 836, 8, 341, 2405, 17364, 284, 3056, 396, 90, 15, 11, 220, 16, 15, 11, 220, 20, 11, 220, 17, 15, 11, 220, 19, 11, 220, 18, 11, 220, 16, 11, 220, 16, 20, 630, 50780, 1669, 3056,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestRoundTripSplitIntervalMiddleware(t *testing.T) { testRequest := &ThanosRequest{ Path: "/api/v1/query_range", Start: 0, End: 2 * hour, Step: 10 * seconds, } codec := NewThanosCodec(true) for _, tc := range []struct { name string splitInterval time.Duration req queryrange.Request handlerAndResult func() (*int, http.Handler) expectError bool expected int }{ { name: "non query range request won't be split 1", req: &ThanosRequest{ Path: "/api/v1/query", Start: 0, End: 2 * hour, Step: 10 * seconds, }, splitInterval: time.Hour, handlerAndResult: counter, expectError: false, expected: 1, }, { name: "non query range request won't be split 2", req: &ThanosRequest{ Path: "/api/v1/labels", Start: 0, End: 2 * hour, Step: 10 * seconds, }, splitInterval: time.Hour, handlerAndResult: counter, expectError: false, expected: 1, }, { name: "split interval == 0, disable split", req: testRequest, splitInterval: 0, handlerAndResult: counter, expectError: true, expected: 1, }, { name: "won't be split. Interval == time range", req: testRequest, splitInterval: 2 * time.Hour, handlerAndResult: counter, expectError: true, expected: 1, }, { name: "won't be split. Interval > time range", req: testRequest, splitInterval: day, handlerAndResult: counter, expectError: true, expected: 1, }, { name: "split to 2 requests", req: testRequest, splitInterval: 1 * time.Hour, handlerAndResult: counter, expectError: true, expected: 2, }, } { t.Run(tc.name, func(t *testing.T) { tpw, err := NewTripperWare(&fakeLimits{}, nil, codec, nil, tc.splitInterval, 0, nil, log.NewNopLogger()) testutil.Ok(t, err) rt, err := newFakeRoundTripper() testutil.Ok(t, err) res, handler := tc.handlerAndResult() rt.setHandler(handler) ctx := user.InjectOrgID(context.Background(), "1") httpReq, err := codec.EncodeRequest(ctx, tc.req) testutil.Ok(t, err) _, err = tpw(rt).RoundTrip(httpReq) testutil.Equals(t, tc.expectError, err != nil) testutil.Equals(t, tc.expected, *res) }) } }
explode_data.jsonl/49918
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1206 }
[ 2830, 3393, 27497, 56352, 20193, 10256, 24684, 1155, 353, 8840, 836, 8, 341, 18185, 1900, 1669, 609, 26067, 436, 1900, 515, 197, 69640, 25, 220, 3521, 2068, 5457, 16, 66762, 9698, 756, 197, 65999, 25, 220, 15, 345, 197, 38407, 25, 256...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestNSERetryClient_RegisterCompletesOnParentContextTimeout(t *testing.T) { t.Cleanup(func() { goleak.VerifyNone(t) }) var callCounter = &count.CallCounter{} var counter = count.NewNetworkServiceEndpointRegistryClient(callCounter) var client = chain.NewNetworkServiceEndpointRegistryClient( retry.NewNetworkServiceEndpointRegistryClient( context.Background(), retry.WithInterval(time.Millisecond*10), retry.WithTryTimeout(time.Second/30)), counter, injecterror.NewNetworkServiceEndpointRegistryClient(), ) var ctx, cancel = context.WithTimeout(context.Background(), time.Millisecond*55) defer cancel() var _, err = client.Register(ctx, nil) require.Error(t, err) require.Greater(t, callCounter.Registers(), 0) }
explode_data.jsonl/68616
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 250 }
[ 2830, 3393, 2448, 640, 15149, 2959, 73124, 66625, 2338, 1925, 8387, 1972, 7636, 1155, 353, 8840, 836, 8, 341, 3244, 727, 60639, 18552, 368, 314, 728, 273, 585, 54853, 4064, 1155, 8, 9568, 2405, 1618, 14099, 284, 609, 1830, 27017, 14099,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestSetProcTitle(t *testing.T) { if HaveSetProcTitle == HaveNone { t.SkipNow() } title := randomMD5() SetProcTitle(title) out, err := exec.Command("/bin/ps", "ax").Output() if err != nil { // No ps available on this platform. t.SkipNow() } else if !strings.Contains(string(out), title) { t.FailNow() } }
explode_data.jsonl/48490
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 131 }
[ 2830, 3393, 1649, 24508, 3851, 1155, 353, 8840, 836, 8, 341, 743, 12243, 1649, 24508, 3851, 621, 12243, 4064, 341, 197, 3244, 57776, 7039, 741, 197, 630, 24751, 1669, 4194, 6076, 20, 2822, 22212, 24508, 3851, 12504, 692, 13967, 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...
4
func TestSvc_SeasonChallengeList(t *testing.T) { svc, cleanup := TestingService(t, ServiceOpts{Logger: testutil.Logger(t)}) defer cleanup() ctx := testingSetContextToken(context.Background(), t) // fetch user session to ensure account is created _, err := svc.UserGetSession(ctx, nil) require.NoError(t, err) seasons := map[string]int64{} for _, season := range testingSeasons(t, svc).Items { seasons[season.Name] = season.ID } var tests = []struct { name string input *SeasonChallengeList_Input expectedErr error expectedItems int }{ {"empty", &SeasonChallengeList_Input{}, errcode.ErrMissingInput, 0}, {"unknown-season-id", &SeasonChallengeList_Input{SeasonID: -42}, errcode.ErrInvalidSeasonID, 0}, {"solo-mode", &SeasonChallengeList_Input{SeasonID: seasons["Solo Mode"]}, nil, 14}, {"test-season", &SeasonChallengeList_Input{SeasonID: seasons["Test Season"]}, errcode.ErrUserHasNoTeamForSeason, 0}, } for _, test := range tests { t.Run(test.name, func(t *testing.T) { ret, err := svc.SeasonChallengeList(ctx, test.input) testSameErrcodes(t, "", test.expectedErr, err) if err != nil { return } //fmt.Println(godev.PrettyJSON(ret.Items)) for _, item := range ret.Items { assert.Equal(t, test.input.SeasonID, item.SeasonID) } assert.Len(t, ret.Items, test.expectedItems) }) } }
explode_data.jsonl/55345
{ "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, 92766, 26920, 1497, 62078, 852, 1155, 353, 8840, 836, 8, 341, 1903, 7362, 11, 21290, 1669, 26768, 1860, 1155, 11, 5362, 43451, 90, 7395, 25, 1273, 1314, 12750, 1155, 59209, 16867, 21290, 741, 20985, 1669, 7497, 1649, 1972, 3...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestPointBls12377G2Random(t *testing.T) { bls12377G2 := BLS12377G2() sc := bls12377G2.Point.Random(testRng()) s, ok := sc.(*PointBls12377G2) require.True(t, ok) expectedX, _ := new(big.Int).SetString("2deeb99988cc46605a5e8eeb50b2c52fc4a12b4537aa8a149431ca85bac2017a32d2a3bf8411d5145bdf587f162a1b01a106e89ebf3210c0926ba07681cd84fc8ae2409b396b24730a8b851d05ba3293b82ae341c472d626c1f55da16ba46d", 16) expectedY, _ := new(big.Int).SetString("b17be752bc4a8ff05824fcf974d232cebe07ee333ce879bf8c7b88ce18813cb190e8a45eddbd7cc5a4b68993ed17770094ab97b85b70b0b80e89c854336b85e46c7259070fb6606b03bcab12d96438f9a79353fafe11733aed51bfa4e798b8", 16) require.Equal(t, s.X(), expectedX) require.Equal(t, s.Y(), expectedY) // Try 10 random values for i := 0; i < 10; i++ { sc := bls12377G2.Point.Random(crand.Reader) _, ok := sc.(*PointBls12377G2) require.True(t, ok) require.True(t, !sc.IsIdentity()) } }
explode_data.jsonl/15762
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 464 }
[ 2830, 3393, 2609, 33, 4730, 16, 17, 18, 22, 22, 38, 17, 13999, 1155, 353, 8840, 836, 8, 341, 96421, 82, 16, 17, 18, 22, 22, 38, 17, 1669, 425, 7268, 16, 17, 18, 22, 22, 38, 17, 741, 29928, 1669, 1501, 82, 16, 17, 18, 22, 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...
2
func TestGetRuntime(t *testing.T) { var result string result = GetRuntime("laughing_feistel", "display", "markdown") assert.Contains(t, result, "display") assert.Contains(t, result, "`") result = GetRuntime("laughing_feistel", "hello_world", "html") assert.Contains(t, result, "hello_world") assert.Contains(t, result, "<pre>") result = GetRuntime("no", "hello_world", "html") assert.Contains(t, result, "Runtime information") }
explode_data.jsonl/54594
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 153 }
[ 2830, 3393, 1949, 15123, 1155, 353, 8840, 836, 8, 341, 2405, 1102, 914, 271, 9559, 284, 2126, 15123, 445, 4260, 7443, 287, 7642, 380, 301, 497, 330, 5493, 497, 330, 60073, 1138, 6948, 11545, 1155, 11, 1102, 11, 330, 5493, 1138, 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 TestValidateAndBuildCellKeyCellidValidationFailure(t *testing.T) { _, err := ValidateAndBuildCellIdKey("") assert.NotNil(t, err) assert.IsType(t, &ValidationError{}, err) assert.Equal(t, "#utils.ValidateAndBuildCellIdKey - an empty cell id received", err.Error()) }
explode_data.jsonl/33039
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 97 }
[ 2830, 3393, 17926, 3036, 11066, 3599, 1592, 3599, 307, 13799, 17507, 1155, 353, 8840, 836, 8, 341, 197, 6878, 1848, 1669, 23282, 3036, 11066, 3599, 764, 1592, 31764, 6948, 93882, 1155, 11, 1848, 340, 6948, 4506, 929, 1155, 11, 609, 8055...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestSimpleQueue_TotalByte(t *testing.T) { q, mem := initEnv(0) defer q.Close() defer mem.Close() txa := &types.Transaction{Payload: []byte("123"), Fee: 100000} mem.cache.Push(txa) txb := &types.Transaction{Payload: []byte("1234"), Fee: 100000} mem.cache.Push(txb) var sumByte int64 mem.cache.Walk(mem.cache.Size(), func(it *Item) bool { sumByte += int64(proto.Size(it.Value)) return true }) require.Equal(t, sumByte, mem.GetTotalCacheBytes()) require.Equal(t, sumByte, int64(19)) mem.cache.Remove(string(txb.Hash())) var sumByte2 int64 mem.cache.Walk(mem.cache.Size(), func(it *Item) bool { sumByte2 += int64(proto.Size(it.Value)) return true }) require.Equal(t, sumByte2, mem.GetTotalCacheBytes()) require.Equal(t, sumByte2, int64(9)) }
explode_data.jsonl/16841
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 316 }
[ 2830, 3393, 16374, 7554, 85933, 7153, 1155, 353, 8840, 836, 8, 341, 18534, 11, 1833, 1669, 2930, 14359, 7, 15, 340, 16867, 2804, 10421, 741, 16867, 1833, 10421, 741, 3244, 9591, 1669, 609, 9242, 29284, 90, 29683, 25, 3056, 3782, 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...
1
func TestPromoteLearnerToPeer_fromLearner(t *testing.T) { learnerRaftId := uint16(3) raftService := newTestRaftService(t, 2, []uint64{1}, []uint64{2, uint64(learnerRaftId)}) _, err := raftService.raftProtocolManager.PromoteToPeer(learnerRaftId) if err == nil { t.Errorf("learner should not be allowed to promote to peer") } if err != nil && !strings.Contains(err.Error(), "learner node can't promote to peer") { t.Errorf("expect error message: propose new peer failed, got: %v\n", err) } }
explode_data.jsonl/13619
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 187 }
[ 2830, 3393, 35186, 1272, 43, 682, 1194, 1249, 30888, 5673, 43, 682, 1194, 1155, 353, 8840, 836, 8, 341, 197, 93595, 55535, 723, 764, 1669, 2622, 16, 21, 7, 18, 340, 197, 2944, 1860, 1669, 501, 2271, 55535, 723, 1860, 1155, 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...
4
func TestSanitizeVolumeID(t *testing.T) { tests := map[string]struct { provided string want string }{ "basic ip example": { provided: "beegfs://127.0.0.1/path/to/volume", want: "127.0.0.1_path_to_volume", }, "basic FQDN example": { provided: "beegfs://some.domain.com/path/to/volume", want: "some.domain.com_path_to_volume", }, "example with underscores": { provided: "beegfs://some.domain.com/path_with_underscores/to/volume", want: "some.domain.com_path__with__underscores_to_volume", }, "example with too many characters": { provided: "beegfs://some.domain.com/lots/of/characters/lots/of/characters/lots/of/characters/" + "lots/of/characters/lots/of/characters/lots/of/characters/lots/of/characters/lots/of/characters/" + "lots/of/characters/lots/of/characters/lots/of/characters/lots/of/characters/lots/of/characters", want: "20d02d3ce23bd842f5a9334f478c87c3f131e51e", }, } for name, tc := range tests { t.Run(name, func(t *testing.T) { got := sanitizeVolumeID(tc.provided) if tc.want != got { t.Fatalf("expected: %s, got: %s", tc.want, got) } }) } }
explode_data.jsonl/77110
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 519 }
[ 2830, 3393, 23729, 26310, 18902, 915, 1155, 353, 8840, 836, 8, 341, 78216, 1669, 2415, 14032, 60, 1235, 341, 197, 197, 63425, 914, 198, 197, 50780, 257, 914, 198, 197, 59403, 197, 197, 1, 22342, 5997, 3110, 788, 341, 298, 197, 63425, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestExpirationBasic(t *testing.T) { unexpectedVal := "bar" expectedVal := "bar2" testObj := testObject{ key: "foo", val: unexpectedVal, } fakeClock := clock.NewFakeClock(time.Now()) objectCache := NewFakeObjectCache(func() (interface{}, error) { return expectedVal, nil }, 1*time.Second, fakeClock) err := objectCache.Add(testObj.key, testObj.val) if err != nil { t.Errorf("Unable to add obj %#v by key: %s", testObj, testObj.key) } // sleep 2s so cache should be expired. fakeClock.Sleep(2 * time.Second) value, err := objectCache.Get(testObj.key) if err != nil { t.Errorf("Unable to get obj %#v by key: %s", testObj, testObj.key) } if value.(string) != expectedVal { t.Errorf("Expected to get cached value: %#v, but got: %s", expectedVal, value.(string)) } }
explode_data.jsonl/44028
{ "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, 66301, 15944, 1155, 353, 8840, 836, 8, 341, 20479, 7325, 2208, 1669, 330, 2257, 698, 42400, 2208, 1669, 330, 2257, 17, 1837, 18185, 5261, 1669, 1273, 1190, 515, 197, 23634, 25, 330, 7975, 756, 197, 19302, 25, 16500, 2208, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestEncodeMD5(t *testing.T) { var tests = []struct { in string out string }{ {"", "d41d8cd98f00b204e9800998ecf8427e"}, {"hello", "5d41402abc4b2a76b9719d911017c592"}, {"小肥猫告别了小瘦猫,去大城市闯荡了。“再见了,小瘦猫,我一只猫也能过得很好。”小肥猫抹下最后一颗泪珠,赌着气给小瘦猫写下了这封诀别信。小瘦猫还在熟睡着,连小肥猫用力关门的“咣当”声都没能把它吵醒。小肥猫一步三回头,却始终没有猫来追它回去。小肥猫叹口气,只能自己一个人去讨生活。她向来是胆小的,面对未知有诸多恐惧。恰逢大雨,航班居然延误十二个小时。坐在旁边的旅客兔小姐对同伴说:“按照我往常的经验,这趟航班应该被取消了”。小肥猫本来坚定下来的心又开始犹犹豫豫打起了鼓,要不要回去呢,可是回去就意味着自己的妥协。就在小肥猫犹豫不决的时候,小瘦猫突然出现了,没有责怪,也没有问小肥猫想离开它之后去哪里,小瘦猫只是把小肥猫拥抱在怀里。小肥猫退了票,像个跟屁虫一样,被小瘦猫牵回了家。小肥猫余气未消,走着走着她甩开手:每次你都是这样,一句多余的话都不说,连我要去哪里都不问吗?小瘦猫当然知道它想赌气离开自己,虽然不知道自己哪里做错了,可能在对待女朋友这里还是觉悟不够高吧。小瘦猫回答说:我不会问的。因为我会难过,无论你去到哪里,那个地方都没有我。", "80e99dc093cafed983ef6428a27ed645"}, } for i, tt := range tests { s := EncodeMD5(tt.in) if s != tt.out { t.Errorf("%d. %q => %q, wanted: %q", i, tt.in, s, tt.out) } } }
explode_data.jsonl/56074
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1241 }
[ 2830, 3393, 32535, 6076, 20, 1155, 353, 8840, 836, 8, 341, 2405, 7032, 284, 3056, 1235, 341, 197, 17430, 220, 914, 198, 197, 13967, 914, 198, 197, 59403, 197, 197, 4913, 497, 330, 67, 19, 16, 67, 23, 4385, 24, 23, 69, 15, 15, 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...
3
func TestOptionFunction(t *testing.T) { logger := defaultLogger() db := dbm.NewMemDB() bap := baseapp.NewBaseApp("starting name", logger, db, testChangeNameHelper("new name")) require.Equal(t, bap.GetName(), "new name", "BaseApp should have had name changed via option function") }
explode_data.jsonl/30028
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 92 }
[ 2830, 3393, 5341, 5152, 1155, 353, 8840, 836, 8, 341, 17060, 1669, 1638, 7395, 741, 20939, 1669, 2927, 76, 7121, 18816, 3506, 741, 2233, 391, 1669, 2331, 676, 7121, 3978, 2164, 445, 39289, 829, 497, 5925, 11, 2927, 11, 1273, 4072, 675...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestWaitForContainerTransitionsForTerminalTask(t *testing.T) { acsMessages := make(chan acsTransition) dockerMessages := make(chan dockerContainerChange) ctx, cancel := context.WithCancel(context.TODO()) defer cancel() task := &managedTask{ acsMessages: acsMessages, dockerMessages: dockerMessages, Task: &apitask.Task{ Containers: []*apicontainer.Container{}, KnownStatusUnsafe: apitaskstatus.TaskStopped, }, ctx: ctx, } transitionChange := make(chan struct{}, 2) transitionChangeContainer := make(chan string, 2) firstContainerName := "container1" secondContainerName := "container2" transitions := make(map[string]string) transitions[firstContainerName] = apicontainerstatus.ContainerPulled.String() transitions[secondContainerName] = apicontainerstatus.ContainerPulled.String() // Event though there are two keys in the transitions map, send // only one event. This tests that `waitForContainerTransition` doesn't // block to receive two events and will still progress go func() { transitionChange <- struct{}{} transitionChangeContainer <- secondContainerName }() task.waitForTransition(transitions, transitionChange, transitionChangeContainer) }
explode_data.jsonl/24576
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 377 }
[ 2830, 3393, 14190, 2461, 4502, 3167, 5930, 2461, 47890, 6262, 1155, 353, 8840, 836, 8, 341, 197, 19252, 15820, 1669, 1281, 35190, 1613, 82, 21768, 340, 2698, 13659, 15820, 1669, 1281, 35190, 26588, 4502, 4072, 340, 20985, 11, 9121, 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 TestStripWhitespaces(t *testing.T) { defer leaktest.AfterTest(t)() testData := []struct { in, out string }{ {" ", ""}, {" \n", "\n"}, {"abc", "abc"}, {"abc ", "abc"}, {"abc \n", "abc\n"}, {"abc \nxyz", "abc\nxyz"}, } for _, test := range testData { t.Run(test.in, func(t *testing.T) { res := stripWhitespaces(test.in) if res != test.out { t.Errorf("%q: got %q, expected %q", test.in, res, test.out) } }) } }
explode_data.jsonl/33193
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 219 }
[ 2830, 3393, 5901, 1639, 3611, 27338, 1155, 353, 8840, 836, 8, 341, 16867, 23352, 1944, 36892, 2271, 1155, 8, 741, 18185, 1043, 1669, 3056, 1235, 341, 197, 17430, 11, 700, 914, 198, 197, 59403, 197, 197, 4913, 3670, 77496, 197, 197, 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 TestDirect_AddSync(t *testing.T) { g := NewGomegaWithT(t) xform, src, acc := setup(g) xform.Start() defer xform.Stop() src.Handlers.Handle(event.AddFor(basicmeta.K8SCollection1, data.EntryN1I1V1)) src.Handlers.Handle(event.FullSyncFor(basicmeta.K8SCollection1)) fixtures.ExpectEventsEventually(t, acc, event.AddFor(basicmeta.Collection2, data.EntryN1I1V1), // XForm to Collection2 event.FullSyncFor(basicmeta.Collection2)) }
explode_data.jsonl/37554
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 174 }
[ 2830, 3393, 16027, 21346, 12154, 1155, 353, 8840, 836, 8, 341, 3174, 1669, 1532, 38, 32696, 2354, 51, 1155, 692, 10225, 627, 11, 2286, 11, 1029, 1669, 6505, 3268, 692, 10225, 627, 12101, 741, 16867, 856, 627, 30213, 2822, 41144, 35308, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestGetDepth(t *testing.T) { ticker, err := anx.GetDepth("BTCUSD") if err != nil { t.Errorf("Test Failed - ANX GetDepth() error: %s", err) } if ticker.Result != "success" { t.Error("Test Failed - ANX GetDepth() unsuccessful") } }
explode_data.jsonl/8475
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 94 }
[ 2830, 3393, 1949, 19776, 1155, 353, 8840, 836, 8, 341, 3244, 5215, 11, 1848, 1669, 73784, 2234, 19776, 445, 59118, 26749, 1138, 743, 1848, 961, 2092, 341, 197, 3244, 13080, 445, 2271, 21379, 481, 2100, 55, 2126, 19776, 368, 1465, 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...
3
func TestFieldCustomize(t *testing.T) { uu := map[string]struct { fields render.Fields cols []int e render.Fields }{ "empty": { fields: render.Fields{}, cols: []int{0, 1, 2}, e: render.Fields{"", "", ""}, }, "no-cols": { fields: render.Fields{"f1", "f2", "f3"}, cols: []int{}, e: render.Fields{}, }, "reverse": { fields: render.Fields{"f1", "f2", "f3"}, cols: []int{1, 0}, e: render.Fields{"f2", "f1"}, }, "missing": { fields: render.Fields{"f1", "f2", "f3"}, cols: []int{10, 0}, e: render.Fields{"", "f1"}, }, } for k := range uu { u := uu[k] t.Run(k, func(t *testing.T) { ff := make(render.Fields, len(u.cols)) u.fields.Customize(u.cols, ff) assert.Equal(t, u.e, ff) }) } }
explode_data.jsonl/66591
{ "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, 1877, 10268, 551, 1155, 353, 8840, 836, 8, 341, 10676, 84, 1669, 2415, 14032, 60, 1235, 341, 197, 55276, 3141, 42809, 198, 197, 1444, 3069, 256, 3056, 396, 198, 197, 7727, 414, 3141, 42809, 198, 197, 59403, 197, 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...
1
func TestSnowflakeHeap(t *testing.T) { Convey("SnowflakeHeap", t, func() { h := new(SnowflakeHeap) heap.Init(h) So(h.Len(), ShouldEqual, 0) s1 := new(Snowflake) s2 := new(Snowflake) s3 := new(Snowflake) s4 := new(Snowflake) s1.clients = 4 s2.clients = 5 s3.clients = 3 s4.clients = 1 heap.Push(h, s1) So(h.Len(), ShouldEqual, 1) heap.Push(h, s2) So(h.Len(), ShouldEqual, 2) heap.Push(h, s3) So(h.Len(), ShouldEqual, 3) heap.Push(h, s4) So(h.Len(), ShouldEqual, 4) heap.Remove(h, 0) So(h.Len(), ShouldEqual, 3) r := heap.Pop(h).(*Snowflake) So(h.Len(), ShouldEqual, 2) So(r.clients, ShouldEqual, 3) So(r.index, ShouldEqual, -1) r = heap.Pop(h).(*Snowflake) So(h.Len(), ShouldEqual, 1) So(r.clients, ShouldEqual, 4) So(r.index, ShouldEqual, -1) r = heap.Pop(h).(*Snowflake) So(h.Len(), ShouldEqual, 0) So(r.clients, ShouldEqual, 5) So(r.index, ShouldEqual, -1) }) }
explode_data.jsonl/18802
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 480 }
[ 2830, 3393, 62285, 63456, 27909, 1155, 353, 8840, 836, 8, 341, 93070, 5617, 445, 62285, 63456, 27909, 497, 259, 11, 2915, 368, 341, 197, 9598, 1669, 501, 3759, 3328, 63456, 27909, 340, 197, 197, 15961, 26849, 3203, 340, 197, 76912, 3203...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestAddPod(t *testing.T) { labels := map[string]string{ "app": "test-pod", } podObj := createPod("test-pod", "test-namespace", "0", "1.2.3.4", labels, NonHostNetwork, corev1.PodRunning) calls := []testutils.TestCmd{ {Cmd: []string{"ipset", "-N", "-exist", util.GetHashedName("ns-test-namespace"), "nethash"}}, {Cmd: []string{"ipset", "-N", "-exist", util.GetHashedName("all-namespaces"), "setlist"}}, {Cmd: []string{"ipset", "-A", "-exist", util.GetHashedName("all-namespaces"), util.GetHashedName("ns-test-namespace")}}, {Cmd: []string{"ipset", "-A", "-exist", util.GetHashedName("ns-test-namespace"), "1.2.3.4"}}, {Cmd: []string{"ipset", "-N", "-exist", util.GetHashedName("app"), "nethash"}}, {Cmd: []string{"ipset", "-A", "-exist", util.GetHashedName("app"), "1.2.3.4"}}, {Cmd: []string{"ipset", "-N", "-exist", util.GetHashedName("app:test-pod"), "nethash"}}, {Cmd: []string{"ipset", "-A", "-exist", util.GetHashedName("app:test-pod"), "1.2.3.4"}}, {Cmd: []string{"ipset", "-N", "-exist", util.GetHashedName("namedport:app:test-pod"), "hash:ip,port"}}, {Cmd: []string{"ipset", "-A", "-exist", util.GetHashedName("namedport:app:test-pod"), "1.2.3.4,8080"}}, } fexec := testutils.GetFakeExecWithScripts(calls) defer testutils.VerifyCalls(t, fexec, calls) f := newFixture(t, fexec) f.podLister = append(f.podLister, podObj) f.kubeobjects = append(f.kubeobjects, podObj) stopCh := make(chan struct{}) defer close(stopCh) f.newPodController(stopCh) addPod(t, f, podObj) testCases := []expectedValues{ {1, 1, 0}, } checkPodTestResult("TestAddPod", f, testCases) checkNpmPodWithInput("TestAddPod", f, podObj) }
explode_data.jsonl/35405
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 686 }
[ 2830, 3393, 2212, 23527, 1155, 353, 8840, 836, 8, 341, 95143, 1669, 2415, 14032, 30953, 515, 197, 197, 1, 676, 788, 330, 1944, 2268, 347, 756, 197, 532, 3223, 347, 5261, 1669, 1855, 23527, 445, 1944, 2268, 347, 497, 330, 1944, 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...
1
func TestClient_Aggregator(t *testing.T) { ctx := context.Background() asUser := userClient(t) withToken := withToken(t, asUser) created, err := withToken.CreateAggregator(ctx, types.CreateAggregator{ Name: "test-aggregator", Version: types.DefaultAggregatorVersion, AddHealthCheckPipeline: true, }) wantEqual(t, err, nil) got, err := asUser.Aggregator(ctx, created.ID) wantEqual(t, err, nil) wantEqual(t, got.ID, created.ID) wantEqual(t, got.Name, created.Name) wantEqual(t, got.Version, created.Version) wantEqual(t, got.Token, created.Token) wantEqual(t, got.PipelinesCount, uint64(1)) wantEqual(t, got.CreatedAt, created.CreatedAt) wantEqual(t, got.UpdatedAt, created.CreatedAt) }
explode_data.jsonl/30418
{ "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, 2959, 1566, 70, 58131, 1155, 353, 8840, 836, 8, 341, 20985, 1669, 2266, 19047, 741, 60451, 1474, 1669, 1196, 2959, 1155, 340, 46948, 3323, 1669, 448, 3323, 1155, 11, 438, 1474, 692, 197, 7120, 11, 1848, 1669, 448, 3323, 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 TestIntegerDeclConforms(t *testing.T) { checkConforms(t, context{}, &IntegerDecl{subtype: fidlir.Uint8, lower: 0, upper: 255}, []conformTest{ conformOk{uint64(0)}, conformOk{uint64(128)}, conformOk{uint64(255)}, conformFail{uint64(256), "out of range"}, conformFail{int64(256), "out of range"}, conformFail{int64(-1), "out of range"}, conformFail{nil, "expecting int64 or uint64"}, conformFail{0, "expecting int64 or uint64"}, conformFail{uint(0), "expecting int64 or uint64"}, conformFail{int8(0), "expecting int64 or uint64"}, conformFail{uint8(0), "expecting int64 or uint64"}, conformFail{"foo", "expecting int64 or uint64"}, conformFail{1.5, "expecting int64 or uint64"}, }, ) checkConforms(t, context{}, &IntegerDecl{subtype: fidlir.Int64, lower: -5, upper: 10}, []conformTest{ conformOk{int64(-5)}, conformOk{int64(10)}, conformOk{uint64(10)}, conformFail{int64(-6), "out of range"}, conformFail{int64(11), "out of range"}, conformFail{uint64(11), "out of range"}, }, ) }
explode_data.jsonl/21394
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 461 }
[ 2830, 3393, 3486, 21629, 1109, 9807, 1155, 353, 8840, 836, 8, 341, 25157, 1109, 9807, 1155, 345, 197, 28413, 38837, 197, 197, 5, 3486, 21629, 90, 77241, 25, 32104, 75, 404, 71869, 23, 11, 4722, 25, 220, 15, 11, 8416, 25, 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...
1
func TestEditEquipmentType(t *testing.T) { r := newTestResolver(t) defer r.drv.Close() ctx := viewertest.NewContext(r.client) mr, qr := r.Mutation(), r.Query() eqType, err := mr.AddEquipmentType(ctx, models.AddEquipmentTypeInput{ Name: "example_type_name", }) require.NoError(t, err) require.Equal(t, "example_type_name", eqType.Name) c, _ := eqType.QueryCategory().Only(ctx) require.Nil(t, c) newType, err := mr.EditEquipmentType(ctx, models.EditEquipmentTypeInput{ ID: eqType.ID, Name: "example_type_name_edited", Category: pointer.ToString("example_type"), }) require.NoError(t, err) require.Equal(t, "example_type_name_edited", newType.Name, "successfully edited equipment type name") c, _ = newType.QueryCategory().Only(ctx) require.Equal(t, "example_type", c.Name) eqType, err = mr.AddEquipmentType(ctx, models.AddEquipmentTypeInput{ Name: "example_type_name_2", }) require.NoError(t, err) _, err = mr.EditEquipmentType(ctx, models.EditEquipmentTypeInput{ ID: eqType.ID, Name: "example_type_name_edited", }) require.Error(t, err, "duplicate names") types, err := qr.EquipmentTypes(ctx, nil, nil, nil, nil) require.NoError(t, err) require.Len(t, types.Edges, 2) typ, err := qr.EquipmentType(ctx, eqType.ID) require.NoError(t, err) require.Equal(t, "example_type_name_2", typ.Name) }
explode_data.jsonl/437
{ "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, 4036, 58276, 929, 1155, 353, 8840, 836, 8, 341, 7000, 1669, 501, 2271, 18190, 1155, 340, 16867, 435, 950, 10553, 10421, 741, 20985, 1669, 1651, 83386, 7121, 1972, 2601, 6581, 340, 2109, 81, 11, 49290, 1669, 435, 1321, 22705,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestSessionPool(t *testing.T) { t.Run("TestLifo", func(t *testing.T) { descChan := make(chan description.Topology) p := NewPool(descChan) p.timeout = 30 // Set to some arbitrarily high number greater than 1 minute. first, err := p.GetSession() testhelpers.RequireNil(t, err, "error getting session %s", err) firstID := first.SessionID second, err := p.GetSession() testhelpers.RequireNil(t, err, "error getting session %s", err) secondID := second.SessionID p.ReturnSession(first) p.ReturnSession(second) sess, err := p.GetSession() testhelpers.RequireNil(t, err, "error getting session %s", err) nextSess, err := p.GetSession() testhelpers.RequireNil(t, err, "error getting session %s", err) if sess.SessionID != secondID { t.Errorf("first sesssion ID mismatch. got %s expected %s", sess.SessionID, secondID) } if nextSess.SessionID != firstID { t.Errorf("second sesssion ID mismatch. got %s expected %s", nextSess.SessionID, firstID) } }) t.Run("TestExpiredRemoved", func(t *testing.T) { descChan := make(chan description.Topology) p := NewPool(descChan) // New sessions will always become stale when returned p.timeout = 0 first, err := p.GetSession() testhelpers.RequireNil(t, err, "error getting session %s", err) firstID := first.SessionID second, err := p.GetSession() testhelpers.RequireNil(t, err, "error getting session %s", err) secondID := second.SessionID p.ReturnSession(first) p.ReturnSession(second) sess, err := p.GetSession() testhelpers.RequireNil(t, err, "error getting session %s", err) if sess.SessionID == firstID || sess.SessionID == secondID { t.Errorf("Expired sessions not removed!") } }) }
explode_data.jsonl/32856
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 637 }
[ 2830, 3393, 5283, 10551, 1155, 353, 8840, 836, 8, 341, 3244, 16708, 445, 2271, 43, 31497, 497, 2915, 1155, 353, 8840, 836, 8, 341, 197, 41653, 46019, 1669, 1281, 35190, 4008, 17557, 2449, 340, 197, 3223, 1669, 1532, 10551, 37673, 46019,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestSharedDepsList(t *testing.T) { for _, tcase := range []struct { chart string golden string wantError bool }{ { chart: "no/such/chart", wantError: true, }, { chart: "testdata/charts/vanilla-helm", golden: "output/shared-deps-no-deps.txt", }, { chart: "testdata/charts/shared-deps-malformed", golden: "output/shared-deps-malformed.txt", wantError: true, }, { chart: "testdata/charts/shared-deps", golden: "output/shared-deps-some-deps.txt", }, { chart: "testdata/charts/optional-deps", golden: "output/shared-deps-only-opt-deps.txt", }, { chart: "testdata/charts/shared-and-optional-deps", golden: "output/shared-and-optional-deps.txt", }, } { // create our own Logger that satisfies impl/cli.Logger, but with a buffer for tests buf := new(bytes.Buffer) logger := logcli.NewStandard() logger.InfoOut = buf logger.WarnOut = buf logger.ErrorOut = buf log.Current = logger settings := cli.New() sharedDepAction := newSharedDepFixture(t, "hypper") err := sharedDepAction.List(tcase.chart, settings, log.Current) if (err != nil) != tcase.wantError { t.Errorf("expected error, got '%v'", err) } if tcase.golden != "" { test.AssertGoldenBytes(t, buf.Bytes(), tcase.golden) } } }
explode_data.jsonl/61034
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 580 }
[ 2830, 3393, 16997, 35, 7124, 852, 1155, 353, 8840, 836, 8, 341, 2023, 8358, 259, 5638, 1669, 2088, 3056, 1235, 341, 197, 197, 15941, 257, 914, 198, 197, 3174, 813, 268, 262, 914, 198, 197, 50780, 1454, 1807, 198, 197, 59403, 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...
4
func TestNamespace(t *testing.T) { t.Run("empty namespace", func(t *testing.T) { rt := NewTestDaprRuntime(modes.StandaloneMode) ns := rt.getNamespace() assert.Empty(t, ns) }) t.Run("non-empty namespace", func(t *testing.T) { os.Setenv("NAMESPACE", "a") defer os.Clearenv() rt := NewTestDaprRuntime(modes.StandaloneMode) ns := rt.getNamespace() assert.Equal(t, "a", ns) }) }
explode_data.jsonl/76071
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 175 }
[ 2830, 3393, 22699, 1155, 353, 8840, 836, 8, 341, 3244, 16708, 445, 3194, 4473, 497, 2915, 1155, 353, 8840, 836, 8, 341, 197, 55060, 1669, 1532, 2271, 35, 59817, 15123, 1255, 2539, 7758, 84112, 3636, 340, 197, 84041, 1669, 16677, 670, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestCombinedStatus(t *testing.T) { defer gock.Off() gock.New("https://api.github.com"). Get("/repos/octocat/hello-world/commits/6dcb09b5b57875f334f61aebed695e2e4193db5e/status"). Reply(200). Type("application/json"). SetHeaders(mockHeaders). SetHeaders(mockPageHeaders). File("testdata/combined_status.json") client := NewDefault() got, res, err := client.Repositories.FindCombinedStatus(context.Background(), "octocat/hello-world", "6dcb09b5b57875f334f61aebed695e2e4193db5e") if err != nil { t.Error(err) return } want := new(scm.CombinedStatus) raw, err := ioutil.ReadFile("testdata/combined_status.json.golden") if err != nil { t.Fatal(err) } if err := json.Unmarshal(raw, want); err != nil { t.Fatal(err) } if diff := cmp.Diff(got, want); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) } t.Run("Request", testRequest(res)) t.Run("Rate", testRate(res)) t.Run("Page", testPage(res)) }
explode_data.jsonl/29869
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 404 }
[ 2830, 3393, 94268, 2522, 1155, 353, 8840, 836, 8, 341, 16867, 728, 377, 13, 4596, 2822, 3174, 1176, 7121, 445, 2428, 1110, 2068, 11021, 905, 38609, 197, 37654, 4283, 68354, 59182, 509, 266, 7530, 4791, 30084, 14, 3621, 1199, 14, 21, 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...
5
func TestVerify(t *testing.T) { msgCryptoService := NewMCS( &mocks.ChannelPolicyManagerGetterWithManager{ Managers: map[string]policies.Manager{ "A": &mocks.ChannelPolicyManager{ Policy: &mocks.Policy{Deserializer: &mocks.IdentityDeserializer{Identity: []byte("Bob"), Msg: []byte("msg2"), Mock: mock.Mock{}}}, }, "B": &mocks.ChannelPolicyManager{ Policy: &mocks.Policy{Deserializer: &mocks.IdentityDeserializer{Identity: []byte("Charlie"), Msg: []byte("msg3"), Mock: mock.Mock{}}}, }, "C": nil, }, }, &mockscrypto.LocalSigner{Identity: []byte("Alice")}, &mocks.DeserializersManager{ LocalDeserializer: &mocks.IdentityDeserializer{Identity: []byte("Alice"), Msg: []byte("msg1"), Mock: mock.Mock{}}, ChannelDeserializers: map[string]msp.IdentityDeserializer{ "A": &mocks.IdentityDeserializer{Identity: []byte("Bob"), Msg: []byte("msg2"), Mock: mock.Mock{}}, "B": &mocks.IdentityDeserializer{Identity: []byte("Charlie"), Msg: []byte("msg3"), Mock: mock.Mock{}}, "C": &mocks.IdentityDeserializer{Identity: []byte("Dave"), Msg: []byte("msg4"), Mock: mock.Mock{}}, }, }, ) msg := []byte("msg1") sigma, err := msgCryptoService.Sign(msg) assert.NoError(t, err, "Failed generating signature") err = msgCryptoService.Verify(api.PeerIdentityType("Alice"), sigma, msg) assert.NoError(t, err, "Alice should verify the signature") err = msgCryptoService.Verify(api.PeerIdentityType("Bob"), sigma, msg) assert.Error(t, err, "Bob should not verify the signature") err = msgCryptoService.Verify(api.PeerIdentityType("Charlie"), sigma, msg) assert.Error(t, err, "Charlie should not verify the signature") sigma, err = msgCryptoService.Sign(msg) assert.NoError(t, err) err = msgCryptoService.Verify(api.PeerIdentityType("Dave"), sigma, msg) assert.Error(t, err) assert.Contains(t, err.Error(), "Could not acquire policy manager") // Check invalid args assert.Error(t, msgCryptoService.Verify(nil, sigma, msg)) }
explode_data.jsonl/26112
{ "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, 32627, 1155, 353, 8840, 836, 8, 341, 21169, 58288, 1860, 1669, 1532, 44, 6412, 1006, 197, 197, 5, 16712, 82, 38716, 13825, 2043, 31485, 2354, 2043, 515, 298, 197, 1658, 11218, 25, 2415, 14032, 60, 79, 42038, 58298, 515, 57...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestRuntime_ExportToStructAnonymous(t *testing.T) { type BaseTestStruct struct { A int64 B int64 } type TestStruct struct { BaseTestStruct C string } const SCRIPT = ` var m = { A: 1, B: 2, C: "testC" } m; ` vm := New() v, err := vm.RunString(SCRIPT) if err != nil { t.Fatal(err) } test := &TestStruct{} err = vm.ExportTo(v, test) if err != nil { t.Fatal(err) } if test.A != 1 { t.Fatalf("Unexpected value: '%d'", test.A) } if test.B != 2 { t.Fatalf("Unexpected value: '%d'", test.B) } if test.C != "testC" { t.Fatalf("Unexpected value: '%s'", test.C) } }
explode_data.jsonl/10474
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 293 }
[ 2830, 3393, 15123, 62, 16894, 1249, 9422, 32684, 1155, 353, 8840, 836, 8, 341, 13158, 5351, 2271, 9422, 2036, 341, 197, 22985, 526, 21, 19, 198, 197, 12791, 526, 21, 19, 198, 197, 630, 13158, 3393, 9422, 2036, 341, 197, 66732, 2271, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestArrayLabelValue(t *testing.T) { arr := pdata.NewAnyValueArray() arr.AppendEmpty() _, ok := arrayLabelValue(arr) require.False(t, ok) mapVal := pdata.NewAttributeValueMap() fillAttributeMap(mapVal.MapVal()) arr = pdata.NewAnyValueArray() mapVal.CopyTo(arr.AppendEmpty()) value, ok := arrayLabelValue(arr) require.True(t, ok) require.Equal(t, attribute.STRING, value.Type()) type Test struct { val pdata.AttributeValue } tests := []Test{ {val: pdata.NewAttributeValueBool(true)}, {val: pdata.NewAttributeValueString("hello")}, {val: pdata.NewAttributeValueInt(123)}, {val: pdata.NewAttributeValueDouble(0.123)}, } for _, test := range tests { arr := pdata.NewAnyValueArray() test.val.CopyTo(arr.AppendEmpty()) value, ok := arrayLabelValue(arr) require.True(t, ok) require.Equal(t, attribute.ARRAY, value.Type()) arr.AppendEmpty() _, ok = arrayLabelValue(arr) require.False(t, ok) } }
explode_data.jsonl/80393
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 365 }
[ 2830, 3393, 1857, 2476, 1130, 1155, 353, 8840, 836, 8, 341, 36511, 1669, 70311, 7121, 8610, 1130, 1857, 741, 36511, 8982, 3522, 741, 197, 6878, 5394, 1669, 1334, 2476, 1130, 10939, 340, 17957, 50757, 1155, 11, 5394, 692, 19567, 2208, 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...
2
func TestFSGapsInSequenceWithExpirationLimits(t *testing.T) { opts := testFSGetOptionsForGapsTests() for _, o := range opts { t.Run(o.name, func(t *testing.T) { cleanupFSDatastore(t) defer cleanupFSDatastore(t) s := createDefaultFileStore(t, o.opt) defer s.Close() limits := testDefaultStoreLimits limits.MaxAge = 100 * time.Millisecond if err := s.SetLimits(&limits); err != nil { t.Fatalf("Error setting limits: %v", err) } cs := storeCreateChannel(t, s, "foo") payload := []byte("msg") storeMsg(t, cs, "foo", 1, payload) storeMsg(t, cs, "foo", 2, payload) storeMsg(t, cs, "foo", 5, payload) time.Sleep(200 * time.Millisecond) n, b := msgStoreState(t, cs.Msgs) if n != 0 || b != 0 { t.Fatalf("Expected no message, got %v/%v", n, b) } storeMsg(t, cs, "foo", 6, payload) n, b = msgStoreState(t, cs.Msgs) if n != 1 || b == 0 { t.Fatalf("Expected 1 message, got %v/%v", n, b) } }) } }
explode_data.jsonl/7783
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 445 }
[ 2830, 3393, 37, 7783, 2625, 641, 14076, 2354, 66301, 94588, 1155, 353, 8840, 836, 8, 341, 64734, 1669, 1273, 8485, 1949, 3798, 2461, 38, 2625, 18200, 741, 2023, 8358, 297, 1669, 2088, 12185, 341, 197, 3244, 16708, 10108, 2644, 11, 2915,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestEtcdUpdateService(t *testing.T) { ctx := api.NewDefaultContext() fakeClient := tools.NewFakeEtcdClient(t) fakeClient.TestIndex = true key, _ := makeServiceKey(ctx, "foo") resp, _ := fakeClient.Set(key, runtime.EncodeOrDie(latest.Codec, &api.Service{TypeMeta: api.TypeMeta{ID: "foo"}}), 0) registry := NewTestEtcdRegistry(fakeClient) testService := api.Service{ TypeMeta: api.TypeMeta{ID: "foo", ResourceVersion: strconv.FormatUint(resp.Node.ModifiedIndex, 10)}, Labels: map[string]string{ "baz": "bar", }, Selector: map[string]string{ "baz": "bar", }, } err := registry.UpdateService(ctx, &testService) if err != nil { t.Errorf("unexpected error: %v", err) } svc, err := registry.GetService(ctx, "foo") if err != nil { t.Errorf("unexpected error: %v", err) } // Clear modified indices before the equality test. svc.ResourceVersion = "" testService.ResourceVersion = "" if !reflect.DeepEqual(*svc, testService) { t.Errorf("Unexpected service: got\n %#v\n, wanted\n %#v", svc, testService) } }
explode_data.jsonl/8171
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 402 }
[ 2830, 3393, 31860, 4385, 4289, 1860, 1155, 353, 8840, 836, 8, 341, 20985, 1669, 6330, 7121, 3675, 1972, 741, 1166, 726, 2959, 1669, 7375, 7121, 52317, 31860, 4385, 2959, 1155, 340, 1166, 726, 2959, 8787, 1552, 284, 830, 198, 23634, 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_BubbleOptimal(t *testing.T) { array := []int{10,50,60,1,29,95,02,6,025,4521,020,4515,2,5,15,24,65,6,1,051,10,24,45,1,4,51,42} list := BubbleOptimal(array) t.Logf("%+v",list) }
explode_data.jsonl/14878
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 105 }
[ 2830, 3393, 1668, 14600, 21367, 2861, 1155, 353, 8840, 836, 8, 341, 11923, 1669, 3056, 396, 90, 16, 15, 11, 20, 15, 11, 21, 15, 11, 16, 11, 17, 24, 11, 24, 20, 11, 15, 17, 11, 21, 11, 15, 17, 20, 11, 19, 20, 17, 16, 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...
1
func TestIndex(t *testing.T) { index := NewSimpleTableIndex() err := index.Insert(1, 10) assert.Nil(t, err) err = index.Insert("one", 10) assert.Nil(t, err) row, err := index.Find("one") assert.Nil(t, err) assert.Equal(t, 10, int(row)) err = index.Delete("one") assert.Nil(t, err) _, err = index.Find("one") assert.NotNil(t, err) schema := catalog.MockSchemaAll(14) schema.PrimaryKey = 1 bat := compute.MockBatch(schema.Types(), 500, int(schema.PrimaryKey), nil) idx := NewSimpleTableIndex() err = idx.BatchDedup(bat.Vecs[0]) assert.Nil(t, err) err = idx.BatchInsert(bat.Vecs[0], 0, gvec.Length(bat.Vecs[0]), 0, false) assert.NotNil(t, err) err = idx.BatchDedup(bat.Vecs[1]) assert.Nil(t, err) err = idx.BatchInsert(bat.Vecs[1], 0, gvec.Length(bat.Vecs[1]), 0, false) assert.Nil(t, err) window := gvec.New(bat.Vecs[1].Typ) gvec.Window(bat.Vecs[1], 20, 22, window) assert.Equal(t, 2, gvec.Length(window)) err = idx.BatchDedup(window) assert.NotNil(t, err) schema.PrimaryKey = 12 bat = compute.MockBatch(schema.Types(), 500, int(schema.PrimaryKey), nil) idx = NewSimpleTableIndex() err = idx.BatchDedup(bat.Vecs[12]) assert.Nil(t, err) err = idx.BatchInsert(bat.Vecs[12], 0, gvec.Length(bat.Vecs[12]), 0, false) assert.Nil(t, err) window = gvec.New(bat.Vecs[12].Typ) gvec.Window(bat.Vecs[12], 20, 22, window) assert.Equal(t, 2, gvec.Length(window)) err = idx.BatchDedup(window) assert.NotNil(t, err) }
explode_data.jsonl/14642
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 674 }
[ 2830, 3393, 1552, 1155, 353, 8840, 836, 8, 341, 26327, 1669, 1532, 16374, 2556, 1552, 741, 9859, 1669, 1922, 23142, 7, 16, 11, 220, 16, 15, 340, 6948, 59678, 1155, 11, 1848, 340, 9859, 284, 1922, 23142, 445, 603, 497, 220, 16, 15, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestFloat32_Clear(t *testing.T) { testcases := []struct { name string s Float32 }{ { name: "test Float32 Clear, s is empty", s: Float32{}, }, { name: "test Float32 Clear, s is not empty", s: map[float32]struct{}{1: {}, 1.5: {}, 1.2: {}}, }, } for _, tc := range testcases { t.Logf("running scenario: %s", tc.name) tc.s.Clear() if len(tc.s) != 0 { t.Errorf("expect empty, but got: %s", tc.s) } } }
explode_data.jsonl/60106
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 220 }
[ 2830, 3393, 5442, 18, 17, 57744, 1155, 353, 8840, 836, 8, 341, 18185, 23910, 1669, 3056, 1235, 341, 197, 11609, 914, 198, 197, 1903, 262, 13001, 18, 17, 198, 197, 59403, 197, 197, 515, 298, 11609, 25, 330, 1944, 13001, 18, 17, 12023...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestBFS(t *testing.T) { g := map[int][]int{ 1: {2, 3}, 2: {4, 5}, 3: {6, 7}, 6: {2}, } t1 := newTestTraversal(g) stopped := BFS(t1, t1.Iter, 1) if stopped { t.Fatalf("Did not expect traversal to stop") } expected := []int{1, 2, 3, 4, 5, 6, 7} if !reflect.DeepEqual(expected, t1.ordered) { t.Fatalf("Expected DFS ordering %v but got: %v", expected, t1.ordered) } }
explode_data.jsonl/30658
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 192 }
[ 2830, 3393, 33, 8485, 1155, 353, 8840, 836, 8, 341, 3174, 1669, 2415, 18640, 45725, 396, 515, 197, 197, 16, 25, 314, 17, 11, 220, 18, 1583, 197, 197, 17, 25, 314, 19, 11, 220, 20, 1583, 197, 197, 18, 25, 314, 21, 11, 220, 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...
3
func TestGetAllComponentParams(t *testing.T) { tests := []struct { jsonnet string expected map[string]Params }{ // Test getting the parameters where there are zero components { ` { global: {}, components: { }, }`, map[string]Params{}, }, // Test getting the parameters where there is a single component { ` { global: {}, components: { bar: { replicas: 5 }, }, }`, map[string]Params{ "bar": Params{"replicas": "5"}, }, }, // Test getting the parameters where there are multiple components { ` { global: {}, components: { bar: { replicas: 5 }, "foo-bar": { name: "foo-bar", replicas: 1, }, }, }`, map[string]Params{ "bar": Params{"replicas": "5"}, "foo-bar": Params{"name": `"foo-bar"`, "replicas": "1"}, }, }, } for _, s := range tests { params, err := GetAllComponentParams(s.jsonnet) if err != nil { t.Errorf("Unexpected error\n input: %v\n error: %v", s.jsonnet, err) } if !reflect.DeepEqual(params, s.expected) { t.Errorf("Wrong conversion\n expected:%v\n got:%v", s.expected, params) } } }
explode_data.jsonl/36749
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 509 }
[ 2830, 3393, 1949, 2403, 2189, 4870, 1155, 353, 8840, 836, 8, 341, 78216, 1669, 3056, 1235, 341, 197, 30847, 4711, 220, 914, 198, 197, 42400, 2415, 14032, 60, 4870, 198, 197, 59403, 197, 197, 322, 3393, 3709, 279, 5029, 1380, 1052, 525...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestErrUnexpectedResponse(t *testing.T) { for _, tc := range socketTestCases(t) { func() { var ( logger = log.TestingLogger() chainID = cmn.RandStr(12) readyCh = make(chan struct{}) errCh = make(chan error, 1) serviceEndpoint = NewSignerServiceEndpoint( logger, chainID, types.NewMockPV(), tc.dialer, ) validatorEndpoint = newSignerValidatorEndpoint( logger, tc.addr, testTimeoutReadWrite) ) testStartEndpoint(t, readyCh, validatorEndpoint) defer validatorEndpoint.Stop() SignerServiceEndpointTimeoutReadWrite(time.Millisecond)(serviceEndpoint) SignerServiceEndpointConnRetries(100)(serviceEndpoint) // we do not want to Start() the remote signer here and instead use the connection to // reply with intentionally wrong replies below: rsConn, err := serviceEndpoint.connect() defer rsConn.Close() require.NoError(t, err) require.NotNil(t, rsConn) // send over public key to get the remote signer running: go testReadWriteResponse(t, &PubKeyResponse{}, rsConn) <-readyCh // Proposal: go func(errc chan error) { errc <- validatorEndpoint.SignProposal(chainID, &types.Proposal{}) }(errCh) // read request and write wrong response: go testReadWriteResponse(t, &SignedVoteResponse{}, rsConn) err = <-errCh require.Error(t, err) require.Equal(t, err, ErrUnexpectedResponse) // Vote: go func(errc chan error) { errc <- validatorEndpoint.SignVote(chainID, &types.Vote{}) }(errCh) // read request and write wrong response: go testReadWriteResponse(t, &SignedProposalResponse{}, rsConn) err = <-errCh require.Error(t, err) require.Equal(t, err, ErrUnexpectedResponse) }() } }
explode_data.jsonl/77987
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 702 }
[ 2830, 3393, 7747, 29430, 2582, 1155, 353, 8840, 836, 8, 341, 2023, 8358, 17130, 1669, 2088, 7575, 2271, 37302, 1155, 8, 341, 197, 29244, 368, 341, 298, 2405, 2399, 571, 17060, 220, 284, 1487, 8787, 287, 7395, 741, 571, 197, 8819, 915,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 Test_Service_Error3(t *testing.T) { bkoff := backoff.NewExponentialBackOff() bkoff.MaxElapsedTime = time.Second * 15 err := backoff.Retry(func() error { logger, _ := test.NewNullLogger() logger.SetLevel(logrus.DebugLevel) c := service.NewContainer(logger) c.Register(ID, &Service{}) err := c.Init(&testCfg{httpCfg: `{ "enable": true, "address": ":6036", "maxRequestSize": 1024, "uploads": { "dir": ` + tmpDir() + `, "forbid": [] }, "workers" "command": "php ../../tests/http/client.php broken pipes", "relay": "pipes", "pool": { "numWorkers": 1, "allocateTimeout": 10000000, "destroyTimeout": 10000000 } } }`}) // assert error if err == nil { return err } return nil }, bkoff) if err != nil { t.Fatal(err) } }
explode_data.jsonl/34505
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 374 }
[ 2830, 3393, 52548, 28651, 18, 1155, 353, 8840, 836, 8, 341, 2233, 74, 1847, 1669, 1182, 1847, 7121, 840, 59825, 3707, 4596, 741, 2233, 74, 1847, 14535, 98483, 284, 882, 32435, 353, 220, 16, 20, 271, 9859, 1669, 1182, 1847, 2013, 15149...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestKubectlCleanup(t *testing.T) { tests := []struct { description string kubectl latestV1.KubectlDeploy commands util.Command shouldErr bool }{ { description: "cleanup success", kubectl: latestV1.KubectlDeploy{ Manifests: []string{"deployment.yaml"}, }, commands: testutil. CmdRunOut("kubectl version --client -ojson", KubectlVersion112). AndRunOut("kubectl --context kubecontext --namespace testNamespace create --dry-run -oyaml -f deployment.yaml", DeploymentWebYAML). AndRun("kubectl --context kubecontext --namespace testNamespace delete --ignore-not-found=true --wait=false -f -"), }, { description: "cleanup success (kubectl v1.18)", kubectl: latestV1.KubectlDeploy{ Manifests: []string{"deployment.yaml"}, }, commands: testutil. CmdRunOut("kubectl version --client -ojson", KubectlVersion118). AndRunOut("kubectl --context kubecontext --namespace testNamespace create --dry-run=client -oyaml -f deployment.yaml", DeploymentWebYAML). AndRun("kubectl --context kubecontext --namespace testNamespace delete --ignore-not-found=true --wait=false -f -"), }, { description: "cleanup error", kubectl: latestV1.KubectlDeploy{ Manifests: []string{"deployment.yaml"}, }, commands: testutil. CmdRunOut("kubectl version --client -ojson", KubectlVersion112). AndRunOut("kubectl --context kubecontext --namespace testNamespace create --dry-run -oyaml -f deployment.yaml", DeploymentWebYAML). AndRunErr("kubectl --context kubecontext --namespace testNamespace delete --ignore-not-found=true --wait=false -f -", errors.New("BUG")), shouldErr: true, }, { description: "additional flags", kubectl: latestV1.KubectlDeploy{ Manifests: []string{"deployment.yaml"}, Flags: latestV1.KubectlFlags{ Global: []string{"-v=0"}, Apply: []string{"ignored"}, Delete: []string{"--grace-period=1"}, }, }, commands: testutil. CmdRunOut("kubectl version --client -ojson", KubectlVersion112). AndRunOut("kubectl --context kubecontext --namespace testNamespace create -v=0 --dry-run -oyaml -f deployment.yaml", DeploymentWebYAML). AndRun("kubectl --context kubecontext --namespace testNamespace delete -v=0 --grace-period=1 --ignore-not-found=true --wait=false -f -"), }, } for _, test := range tests { testutil.Run(t, test.description, func(t *testutil.T) { t.Override(&util.DefaultExecCommand, test.commands) t.NewTempDir(). Write("deployment.yaml", DeploymentWebYAML). Chdir() k, err := NewDeployer(&kubectlConfig{ workingDir: ".", RunContext: runcontext.RunContext{Opts: config.SkaffoldOptions{Namespace: TestNamespace}}, }, &label.DefaultLabeller{}, &test.kubectl) t.RequireNoError(err) err = k.Cleanup(context.Background(), ioutil.Discard) t.CheckError(test.shouldErr, err) }) } }
explode_data.jsonl/52875
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1178 }
[ 2830, 3393, 42, 53380, 67335, 1155, 353, 8840, 836, 8, 341, 78216, 1669, 3056, 1235, 341, 197, 42407, 914, 198, 197, 16463, 53380, 257, 5535, 53, 16, 11352, 53380, 69464, 198, 197, 197, 24270, 262, 4094, 12714, 198, 197, 197, 5445, 77...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestSetSmShop(t *testing.T) { bsToken := getBusToken() mSm := new(logics.SmLogic) args := &cards.ArgsSetSmShop{ BsToken: bsToken, SmIds: []int{1, 2, 3, 4, 5}, ShopIds: []int{1}, IsAllShop: false, } logs.Info(mSm.SetSmShop(context.Background(), args)) }
explode_data.jsonl/35924
{ "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, 1649, 10673, 19795, 1155, 353, 8840, 836, 8, 341, 93801, 3323, 1669, 633, 15073, 3323, 741, 2109, 10673, 1669, 501, 12531, 1211, 92445, 26751, 340, 31215, 1669, 609, 25024, 51015, 1649, 10673, 19795, 515, 197, 12791, 82, 3323,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestCurrentUser(t *testing.T) { var userEnv string if runtime.GOOS == "windows" { userEnv = os.Getenv("USERNAME") } else { userEnv = os.Getenv("USER") } username, err := CurrentUser() if userEnv != "" && err != nil { t.Fatalf("If $USER is not blank, error should not happen. Error: %v", err) } if userEnv != username { t.Errorf("Fetched the wrong username. $USER: %v, username: %v", userEnv, username) } }
explode_data.jsonl/22083
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 166 }
[ 2830, 3393, 78257, 1155, 353, 8840, 836, 8, 341, 2405, 1196, 14359, 914, 198, 743, 15592, 97574, 3126, 621, 330, 27077, 1, 341, 197, 19060, 14359, 284, 2643, 64883, 445, 63516, 1138, 197, 92, 770, 341, 197, 19060, 14359, 284, 2643, 64...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestEvalIfNode(t *testing.T) { var data = make(VarMap) data.Set("lower", strings.ToLower) data.Set("upper", strings.ToUpper) data.Set("repeat", strings.Repeat) data.Set("user", &User{ "José Santos", "email@example.com", }) RunJetTest(t, data, nil, "ifNode_simples", `{{if true}}hello{{end}}`, `hello`) RunJetTest(t, data, nil, "ifNode_else", `{{if false}}hello{{else}}world{{end}}`, `world`) RunJetTest(t, data, nil, "ifNode_elseif", `{{if false}}hello{{else if true}}world{{end}}`, `world`) RunJetTest(t, data, nil, "ifNode_elseif_else", `{{if false}}hello{{else if false}}world{{else}}buddy{{end}}`, `buddy`) RunJetTest(t, data, nil, "ifNode_string_comparison", `{{user.Name}} (email: {{user.Email}}): {{if user.Email == "email2@example.com"}}email is email2@example.com{{else}}email is not email2@example.com{{end}}`, `José Santos (email: email@example.com): email is not email2@example.com`) }
explode_data.jsonl/22894
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 352 }
[ 2830, 3393, 54469, 2679, 1955, 1155, 353, 8840, 836, 8, 341, 2405, 821, 284, 1281, 7, 3962, 2227, 340, 8924, 4202, 445, 14772, 497, 9069, 29983, 340, 8924, 4202, 445, 13574, 497, 9069, 49396, 340, 8924, 4202, 445, 30624, 497, 9069, 28...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestNewWorker(t *testing.T) { // Setup a new blockchain with genesis block containing test token on test address var ( database = ethdb.NewMemDatabase() gspec = core.Genesis{ Config: chainConfig, Factory: blockFactory, Alloc: core.GenesisAlloc{testBankAddress: {Balance: testBankFunds}}, ShardID: 10, } ) genesis := gspec.MustCommit(database) _ = genesis chain, _ := core.NewBlockChain(database, nil, gspec.Config, chain2.Engine, vm.Config{}, nil) // Create a new worker worker := New(params.TestChainConfig, chain, chain2.Engine) if worker.GetCurrentState().GetBalance(crypto.PubkeyToAddress(testBankKey.PublicKey)).Cmp(testBankFunds) != 0 { t.Error("Worker state is not setup correctly") } }
explode_data.jsonl/44238
{ "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, 3564, 21936, 1155, 353, 8840, 836, 8, 341, 197, 322, 18626, 264, 501, 17944, 448, 59366, 2504, 8482, 1273, 3950, 389, 1273, 2621, 198, 2405, 2399, 197, 2698, 2211, 284, 8372, 1999, 7121, 18816, 5988, 741, 197, 3174, 9535, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestInputService5ProtocolTestNonFlattenedListsCase1(t *testing.T) { sess := session.New() svc := NewInputService5ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) input := &InputService5TestShapeInputService5TestCaseOperation1Input{ ListParam: []*string{ aws.String("one"), aws.String("two"), aws.String("three"), }, } req, _ := svc.InputService5TestCaseOperation1Request(input) r := req.HTTPRequest // build request restxml.Build(req) assert.NoError(t, req.Error) // assert body assert.NotNil(t, r.Body) body := util.SortXML(r.Body) awstesting.AssertXML(t, `<OperationRequest xmlns="https://foo/"><ListParam xmlns="https://foo/"><member xmlns="https://foo/">one</member><member xmlns="https://foo/">two</member><member xmlns="https://foo/">three</member></ListParam></OperationRequest>`, util.Trim(string(body)), InputService5TestShapeInputService5TestCaseOperation1Input{}) // assert URL awstesting.AssertURL(t, "https://test/2014-01-01/hostedzone", r.URL.String()) // assert headers }
explode_data.jsonl/46475
{ "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, 2505, 1860, 20, 20689, 2271, 8121, 3882, 1587, 6758, 37848, 4207, 16, 1155, 353, 8840, 836, 8, 341, 1903, 433, 1669, 3797, 7121, 741, 1903, 7362, 1669, 1532, 2505, 1860, 20, 20689, 2271, 57223, 11, 609, 8635, 10753, 90, 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, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestMarshalJSONPBMarshaler(t *testing.T) { rawJson := `{ "foo": "bar", "baz": [0, 1, 2, 3] }` msg := dynamicMessage{RawJson: rawJson} str, err := new(Marshaler).MarshalToString(&msg) if err != nil { t.Errorf("an unexpected error occurred when marshaling JSONPBMarshaler: %v", err) } if str != rawJson { t.Errorf("marshaling JSON produced incorrect output: got %s, wanted %s", str, rawJson) } }
explode_data.jsonl/63116
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 159 }
[ 2830, 3393, 55438, 5370, 40637, 55438, 261, 1155, 353, 8840, 836, 8, 341, 76559, 5014, 1669, 53692, 330, 7975, 788, 330, 2257, 497, 330, 42573, 788, 508, 15, 11, 220, 16, 11, 220, 17, 11, 220, 18, 60, 335, 3989, 21169, 1669, 8741, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestKeys_CertCA(t *testing.T) { keys, err := NewKeys() require.NoError(t, err) assert.NotNil(t, keys) assert.NoError(t, keys.Generate()) assert.Nil(t, keys.certCARoot) ca := &x509.Certificate{ SerialNumber: big.NewInt(2019), Subject: pkix.Name{ Organization: []string{"TEST, INC."}, Country: []string{"RU"}, Province: []string{""}, Locality: []string{"Krasnodar"}, StreetAddress: []string{"Krasnaya"}, PostalCode: []string{"350000"}, }, NotBefore: time.Now(), NotAfter: time.Now().Add(time.Second * 30), IsCA: true, ExtKeyUsage: []x509.ExtKeyUsage{x509.ExtKeyUsageClientAuth, x509.ExtKeyUsageServerAuth}, KeyUsage: x509.KeyUsageDigitalSignature | x509.KeyUsageCertSign, BasicConstraintsValid: true, } assert.NoError(t, keys.CreateCAROOT(ca)) assert.NotNil(t, keys.certCARoot) }
explode_data.jsonl/11408
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 426 }
[ 2830, 3393, 8850, 920, 529, 5049, 1155, 353, 8840, 836, 8, 341, 80112, 11, 1848, 1669, 1532, 8850, 741, 17957, 35699, 1155, 11, 1848, 340, 6948, 93882, 1155, 11, 6894, 692, 6948, 35699, 1155, 11, 6894, 57582, 2398, 6948, 59678, 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 TestClientDisallowMultipleConns(t *testing.T) { defer leaktest.AfterTest(t)() stopper := stop.NewStopper() defer stopper.Stop(context.TODO()) local := startGossip(1, stopper, t, metric.NewRegistry()) remote := startGossip(2, stopper, t, metric.NewRegistry()) local.mu.Lock() remote.mu.Lock() rAddr := remote.mu.is.NodeAddr // Start two clients from local to remote. RPC client cache is // disabled via the context, so we'll start two different outgoing // connections. local.startClientLocked(&rAddr) local.startClientLocked(&rAddr) local.mu.Unlock() remote.mu.Unlock() local.manage() remote.manage() testutils.SucceedsSoon(t, func() error { // Verify that the remote server has only a single incoming // connection and the local server has only a single outgoing // connection. local.mu.Lock() remote.mu.Lock() outgoing := local.outgoing.len() incoming := remote.mu.incoming.len() local.mu.Unlock() remote.mu.Unlock() if outgoing == 1 && incoming == 1 && verifyServerMaps(local, 0) && verifyServerMaps(remote, 1) { return nil } return errors.Errorf("incorrect number of incoming (%d) or outgoing (%d) connections", incoming, outgoing) }) }
explode_data.jsonl/18549
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 413 }
[ 2830, 3393, 2959, 87854, 32089, 1109, 4412, 1155, 353, 8840, 836, 8, 341, 16867, 23352, 1944, 36892, 2271, 1155, 8, 741, 62644, 712, 1669, 2936, 7121, 10674, 712, 741, 16867, 2936, 712, 30213, 5378, 90988, 2398, 8854, 1669, 1191, 38, 41...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestOpenMoreThanOnceInSameProcess(t *testing.T) { t.Parallel() path := testRepoPath("", t) assert.Nil(Init(path, &config.Config{Datastore: config.DefaultDatastoreConfig()}), t) r1, err := Open(path) assert.Nil(err, t, "first repo should open successfully") r2, err := Open(path) assert.Nil(err, t, "second repo should open successfully") assert.True(r1 == r2, t, "second open returns same value") assert.Nil(r1.Close(), t) assert.Nil(r2.Close(), t) }
explode_data.jsonl/24177
{ "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, 5002, 7661, 26067, 12522, 641, 19198, 7423, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 741, 26781, 1669, 1273, 25243, 1820, 19814, 259, 340, 6948, 59678, 7, 3803, 5581, 11, 609, 1676, 10753, 90, 1043, 4314, 25, 2193, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestGenerateProfile(t *testing.T) { var tests = []struct { description string skaffoldConfig *latestV1.SkaffoldConfig expectedProfile *latestV1.Profile responses []string namespace string shouldErr bool }{ { description: "successful profile generation docker", skaffoldConfig: &latestV1.SkaffoldConfig{ Pipeline: latestV1.Pipeline{ Build: latestV1.BuildConfig{ Artifacts: []*latestV1.Artifact{ { ImageName: "test", ArtifactType: latestV1.ArtifactType{ DockerArtifact: &latestV1.DockerArtifact{}, }, }, }, }, }, }, namespace: "", expectedProfile: &latestV1.Profile{ Name: "oncluster", Pipeline: latestV1.Pipeline{ Build: latestV1.BuildConfig{ Artifacts: []*latestV1.Artifact{ { ImageName: "test-pipeline", ArtifactType: latestV1.ArtifactType{ KanikoArtifact: &latestV1.KanikoArtifact{}, }, }, }, BuildType: latestV1.BuildType{ Cluster: &latestV1.ClusterDetails{ PullSecretName: "kaniko-secret", }, }, }, }, }, shouldErr: false, }, { description: "successful profile generation jib", skaffoldConfig: &latestV1.SkaffoldConfig{ Pipeline: latestV1.Pipeline{ Build: latestV1.BuildConfig{ Artifacts: []*latestV1.Artifact{ { ImageName: "test", ArtifactType: latestV1.ArtifactType{ JibArtifact: &latestV1.JibArtifact{ Project: "test-module", }, DockerArtifact: nil, }, }, }, }, }, }, namespace: "", expectedProfile: &latestV1.Profile{ Name: "oncluster", Pipeline: latestV1.Pipeline{ Build: latestV1.BuildConfig{ Artifacts: []*latestV1.Artifact{ { ImageName: "test-pipeline", ArtifactType: latestV1.ArtifactType{ JibArtifact: &latestV1.JibArtifact{ Project: "test-module", }, }, }, }, }, }, }, shouldErr: false, }, { description: "kaniko artifact with namespace", skaffoldConfig: &latestV1.SkaffoldConfig{ Pipeline: latestV1.Pipeline{ Build: latestV1.BuildConfig{ Artifacts: []*latestV1.Artifact{ { ImageName: "test", ArtifactType: latestV1.ArtifactType{ DockerArtifact: &latestV1.DockerArtifact{}, }, }, }, }, }, }, namespace: "test-ns", expectedProfile: &latestV1.Profile{ Name: "oncluster", Pipeline: latestV1.Pipeline{ Build: latestV1.BuildConfig{ Artifacts: []*latestV1.Artifact{ { ImageName: "test-pipeline", ArtifactType: latestV1.ArtifactType{ KanikoArtifact: &latestV1.KanikoArtifact{}, }, }, }, BuildType: latestV1.BuildType{ Cluster: &latestV1.ClusterDetails{ PullSecretName: "kaniko-secret", Namespace: "test-ns", }, }, }, }, }, shouldErr: false, }, { description: "failed profile generation", skaffoldConfig: &latestV1.SkaffoldConfig{ Pipeline: latestV1.Pipeline{ Build: latestV1.BuildConfig{ Artifacts: []*latestV1.Artifact{}, }, }, }, expectedProfile: nil, shouldErr: true, }, } for _, test := range tests { testutil.Run(t, test.description, func(t *testutil.T) { profile, err := generateProfile(ioutil.Discard, test.namespace, test.skaffoldConfig) t.CheckErrorAndDeepEqual(test.shouldErr, err, test.expectedProfile, profile) }) } }
explode_data.jsonl/48470
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1852 }
[ 2830, 3393, 31115, 8526, 1155, 353, 8840, 836, 8, 341, 2405, 7032, 284, 3056, 1235, 341, 197, 42407, 257, 914, 198, 197, 1903, 74, 2649, 813, 2648, 220, 353, 19350, 53, 16, 808, 74, 2649, 813, 2648, 198, 197, 42400, 8526, 353, 19350...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestSnapshotMethods(t *testing.T) { defer leaktest.AfterTest(t)() runWithAllEngines(func(engine Engine, t *testing.T) { keys := []MVCCKey{mvccKey("a"), mvccKey("b")} vals := [][]byte{[]byte("1"), []byte("2")} for i := range keys { if err := engine.Put(keys[i], vals[i]); err != nil { t.Fatal(err) } if val, err := engine.Get(keys[i]); err != nil { t.Fatal(err) } else if !bytes.Equal(vals[i], val) { t.Fatalf("expected %s, but found %s", vals[i], val) } } snap := engine.NewSnapshot() defer snap.Close() // Verify Attrs. var attrs roachpb.Attributes switch engine.(type) { case Engine: attrs = inMemAttrs } if !reflect.DeepEqual(engine.Attrs(), attrs) { t.Errorf("attrs mismatch; expected %+v, got %+v", attrs, engine.Attrs()) } // Verify Get. for i := range keys { valSnapshot, err := snap.Get(keys[i]) if err != nil { t.Fatal(err) } if !bytes.Equal(vals[i], valSnapshot) { t.Fatalf("the value %s in get result does not match the value %s in snapshot", vals[i], valSnapshot) } } // Verify Scan. keyvals, _ := Scan(engine, mvccKey(roachpb.RKeyMin), mvccKey(roachpb.RKeyMax), 0) keyvalsSnapshot, err := Scan(snap, mvccKey(roachpb.RKeyMin), mvccKey(roachpb.RKeyMax), 0) if err != nil { t.Fatal(err) } if !reflect.DeepEqual(keyvals, keyvalsSnapshot) { t.Fatalf("the key/values %v in scan result does not match the value %s in snapshot", keyvals, keyvalsSnapshot) } // Verify Iterate. index := 0 if err := snap.Iterate(mvccKey(roachpb.RKeyMin), mvccKey(roachpb.RKeyMax), func(kv MVCCKeyValue) (bool, error) { if !kv.Key.Equal(keys[index]) || !bytes.Equal(kv.Value, vals[index]) { t.Errorf("%d: key/value not equal between expected and snapshot: %s/%s, %s/%s", index, keys[index], vals[index], kv.Key, kv.Value) } index++ return false, nil }); err != nil { t.Fatal(err) } // Write a new key to engine. newKey := mvccKey("c") newVal := []byte("3") if err := engine.Put(newKey, newVal); err != nil { t.Fatal(err) } // Verify NewIterator still iterates over original snapshot. iter := snap.NewIterator(IterOptions{UpperBound: roachpb.KeyMax}) iter.Seek(newKey) if ok, err := iter.Valid(); err != nil { t.Fatal(err) } else if ok { t.Error("expected invalid iterator when seeking to element which shouldn't be visible to snapshot") } iter.Close() }, t) }
explode_data.jsonl/38117
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1057 }
[ 2830, 3393, 15009, 17856, 1155, 353, 8840, 836, 8, 341, 16867, 23352, 1944, 36892, 2271, 1155, 8, 741, 56742, 2354, 2403, 4106, 1543, 18552, 48974, 8200, 11, 259, 353, 8840, 836, 8, 341, 197, 80112, 1669, 3056, 66626, 3706, 1592, 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...
6
func TestInstallCommand(t *testing.T) { validInstallCmd := IsInstallCmd([]string{"--install"}) assert.Equal(t, true, validInstallCmd) validInstallCmd = IsInstallCmd([]string{"-install"}) assert.Equal(t, true, validInstallCmd) }
explode_data.jsonl/5832
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 78 }
[ 2830, 3393, 24690, 4062, 1155, 353, 8840, 836, 8, 341, 56322, 24690, 15613, 1669, 2160, 24690, 15613, 10556, 917, 4913, 313, 12248, 23625, 6948, 12808, 1155, 11, 830, 11, 2697, 24690, 15613, 340, 56322, 24690, 15613, 284, 2160, 24690, 156...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestTuple(t *testing.T) { require := require.New(t) typ := Tuple(Int32, Text, Int64) _, err := typ.Convert("foo") require.Error(err) require.True(ErrNotTuple.Is(err)) _, err = typ.Convert([]interface{}{1, 2}) require.Error(err) require.True(ErrInvalidColumnNumber.Is(err)) convert(t, typ, []interface{}{1, 2, 3}, []interface{}{int32(1), "2", int64(3)}) require.Panics(func() { typ.SQL(nil) }) require.Equal(sqltypes.Expression, typ.Type()) 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}) }
explode_data.jsonl/54306
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 391 }
[ 2830, 3393, 28681, 1155, 353, 8840, 836, 8, 341, 17957, 1669, 1373, 7121, 1155, 692, 25314, 1669, 24622, 24123, 18, 17, 11, 2918, 11, 1333, 21, 19, 340, 197, 6878, 1848, 1669, 3582, 36179, 445, 7975, 1138, 17957, 6141, 3964, 340, 1795...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestSendAlertWithoutTitle(t *testing.T) { sqsMock := &mockSqs{} sqsClient = sqsMock mockRoundTripper := &mockRoundTripper{} httpClient = &http.Client{Transport: mockRoundTripper} policyConfig = policiesclient.DefaultTransportConfig(). WithHost("host"). WithBasePath("path") policyClient = policiesclient.NewHTTPClientWithConfig(nil, policyConfig) testEvent := &AlertDedupEvent{ RuleID: "ruleId", RuleVersion: "ruleVersion", DeduplicationString: "dedupString", AlertCount: 10, CreationTime: time.Now().UTC(), UpdateTime: time.Now().UTC(), Severity: "INFO", EventCount: 100, LogTypes: []string{"Log.Type.1", "Log.Type.2"}, Title: nil, } expectedAlert := &alertModel.Alert{ CreatedAt: aws.Time(testEvent.CreationTime), PolicyDescription: aws.String("Description"), PolicyID: aws.String(testEvent.RuleID), PolicyVersionID: aws.String(testEvent.RuleVersion), PolicyName: aws.String("DisplayName"), Runbook: aws.String("Runbook"), Severity: aws.String(testAlertDedupEvent.Severity), Tags: aws.StringSlice([]string{"Tag"}), Type: aws.String(alertModel.RuleType), AlertID: aws.String("8c1b7f1a597d0480354e66c3a6266ccc"), } expectedMarshaledEvent, err := jsoniter.MarshalToString(expectedAlert) require.NoError(t, err) expectedSendMessageInput := &sqs.SendMessageInput{ MessageBody: aws.String(expectedMarshaledEvent), QueueUrl: aws.String("queueUrl"), } mockRoundTripper.On("RoundTrip", mock.Anything).Return(generateResponse(testRuleResponse, http.StatusOK), nil).Once() sqsMock.On("SendMessage", expectedSendMessageInput).Return(&sqs.SendMessageOutput{}, nil) assert.NoError(t, SendAlert(testEvent)) sqsMock.AssertExpectations(t) mockRoundTripper.AssertExpectations(t) }
explode_data.jsonl/39036
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 817 }
[ 2830, 3393, 11505, 9676, 26040, 3851, 1155, 353, 8840, 836, 8, 341, 1903, 26358, 11571, 1669, 609, 16712, 50, 26358, 16094, 1903, 26358, 2959, 284, 18031, 82, 11571, 271, 77333, 27497, 21884, 6922, 1669, 609, 16712, 27497, 21884, 6922, 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 TestFloat64Increment(t *testing.T) { if err := quick.Check(func(v float64) bool { a := NewFloat64(v) v++ return a.Increment() == v && a.Load() == v }, nil); err != nil { t.Fatal(err) } }
explode_data.jsonl/30769
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 89 }
[ 2830, 3393, 5442, 21, 19, 38311, 1155, 353, 8840, 836, 8, 341, 743, 1848, 1669, 3974, 10600, 18552, 3747, 2224, 21, 19, 8, 1807, 341, 197, 11323, 1669, 1532, 5442, 21, 19, 3747, 340, 197, 5195, 22940, 197, 853, 264, 5337, 13477, 368...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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