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 TestInternalDetect(t *testing.T) { teseerr := errors.New("test error") tests := []struct { name string mockString []string mockError error expectString []string expectError error }{ { "normal", []string{"en_US"}, nil, []string{"en_US"}, nil, }, { "not detected", []string(nil), ErrNotDetected, []string(nil), ErrNotDetected, }, { "not detected", []string(nil), teseerr, []string(nil), teseerr, }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { mockLang.set(tt.mockString, tt.mockError) lang, err := detect() if tt.expectError != nil { assert.True(t, errors.Is(err, tt.expectError)) assert.Empty(t, lang) } else { assert.Nil(t, err) assert.EqualValues(t, tt.expectString, lang) } }) } }
explode_data.jsonl/80091
{ "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, 11569, 57193, 1155, 353, 8840, 836, 8, 341, 197, 2338, 68, 615, 1669, 5975, 7121, 445, 1944, 1465, 1138, 78216, 1669, 3056, 1235, 341, 197, 11609, 260, 914, 198, 197, 77333, 703, 256, 3056, 917, 198, 197, 77333, 1454, 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...
2
func TestTaskFromACSPerContainerTimeouts(t *testing.T) { modelTimeout := int64(10) expectedTimeout := uint(modelTimeout) taskFromACS := ecsacs.Task{ Containers: []*ecsacs.Container{ { StartTimeout: aws.Int64(modelTimeout), StopTimeout: aws.Int64(modelTimeout), }, }, } seqNum := int64(42) task, err := TaskFromACS(&taskFromACS, &ecsacs.PayloadMessage{SeqNum: &seqNum}) assert.Nil(t, err, "Should be able to handle acs task") assert.Equal(t, task.Containers[0].StartTimeout, expectedTimeout) assert.Equal(t, task.Containers[0].StopTimeout, expectedTimeout) }
explode_data.jsonl/37264
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 227 }
[ 2830, 3393, 6262, 3830, 62687, 3889, 4502, 7636, 82, 1155, 353, 8840, 836, 8, 341, 19727, 7636, 1669, 526, 21, 19, 7, 16, 15, 340, 42400, 7636, 1669, 2622, 7635, 7636, 692, 49115, 3830, 62687, 1669, 78422, 19252, 28258, 515, 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
func TestDirect_SyncReset(t *testing.T) { g := NewGomegaWithT(t) xform, src, acc := setup(g) xform.Start() defer xform.Stop() src.Handlers.Handle(event.FullSyncFor(basicmeta.K8SCollection1)) src.Handlers.Handle(event.Event{Kind: event.Reset}) fixtures.ExpectEventsEventually(t, acc, event.FullSyncFor(basicmeta.Collection2), event.Event{Kind: event.Reset}, ) }
explode_data.jsonl/37557
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 149 }
[ 2830, 3393, 16027, 1098, 1721, 14828, 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, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestBug578(t *testing.T) { dir, err := ioutil.TempDir("", "badger-test") y.Check(err) defer removeDir(dir) db, err := Open(DefaultOptions(dir). WithValueLogMaxEntries(64). WithMaxTableSize(1 << 13)) require.NoError(t, err) h := testHelper{db: db, t: t} // Let's run this whole thing a few times. for j := 0; j < 10; j++ { t.Logf("Cycle: %d\n", j) h.writeRange(0, 32) h.writeRange(0, 10) h.writeRange(50, 72) h.writeRange(40, 72) h.writeRange(40, 72) // Run value log GC a few times. for i := 0; i < 5; i++ { db.RunValueLogGC(0.5) } h.readRange(0, 10) } require.NoError(t, db.Close()) }
explode_data.jsonl/39100
{ "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, 46773, 20, 22, 23, 1155, 353, 8840, 836, 8, 341, 48532, 11, 1848, 1669, 43144, 65009, 6184, 19814, 330, 13855, 1389, 16839, 1138, 14522, 10600, 3964, 340, 16867, 4057, 6184, 14161, 692, 20939, 11, 1848, 1669, 5264, 87874, 37...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestClear(t *testing.T) { m := NewSharedMap() // Insert 100 elements. for i := 0; i < 100; i++ { m.Store(strconv.Itoa(i), Animal{strconv.Itoa(i)}) } m.Clear() count := 0 m.Range(func(key, value interface{}) bool { count++ return true }) if count != 0 { t.Error("We should have 0 elements.") } }
explode_data.jsonl/77835
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 135 }
[ 2830, 3393, 14008, 1155, 353, 8840, 836, 8, 341, 2109, 1669, 1532, 16997, 2227, 2822, 197, 322, 17101, 220, 16, 15, 15, 5424, 624, 2023, 600, 1669, 220, 15, 26, 600, 366, 220, 16, 15, 15, 26, 600, 1027, 341, 197, 2109, 38047, 4199...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestCreateNewFileKeyValueStore(t *testing.T) { _, err := New( &FileKeyValueStoreOptions{ Path: "", }) if err == nil || err.Error() != "FileKeyValueStore path is empty" { t.Fatal("File path validation on NewFileKeyValueStore is not working as expected") } _, err = New(nil) if err == nil || err.Error() != "FileKeyValueStoreOptions is nil" { t.Fatal("File path validation on NewFileKeyValueStore is not working as expected") } var store core.KVStore store, err = New( &FileKeyValueStoreOptions{ Path: storePath, }) if err != nil { t.Fatal("creating a store shouldn't fail") } if store == nil { t.Fatal("creating a store failed") } }
explode_data.jsonl/12216
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 244 }
[ 2830, 3393, 4021, 3564, 1703, 72082, 6093, 1155, 353, 8840, 836, 8, 1476, 197, 6878, 1848, 1669, 1532, 1006, 197, 197, 5, 1703, 72082, 6093, 3798, 515, 298, 69640, 25, 8324, 197, 197, 3518, 743, 1848, 621, 2092, 1369, 1848, 6141, 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...
7
func TestGetTargetPort(t *testing.T) { tests := []struct { name string svc *service svcPort backendPort expected string errExpected bool }{ { name: "svc1", svc: &service{ Spec: &serviceSpec{ Ports: []*servicePort{ { Port: 80, TargetPort: &backendPort{value: 5000}, }, }, }}, svcPort: backendPort{value: 80}, expected: "80", errExpected: false, }, { name: "svc without targetport", svc: &service{ Spec: &serviceSpec{ Ports: []*servicePort{ { Port: 80, }, }, }}, svcPort: backendPort{value: 80}, expected: "", errExpected: true, }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { if got, err := tt.svc.getTargetPort(tt.svcPort); got != tt.expected && (err != nil && !tt.errExpected) { t.Errorf("getTargetPort: %v, expected: %v, err: %v", got, tt.expected, err) } }) } }
explode_data.jsonl/60358
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 507 }
[ 2830, 3393, 1949, 6397, 7084, 1155, 353, 8840, 836, 8, 341, 78216, 1669, 3056, 1235, 341, 197, 11609, 286, 914, 198, 197, 1903, 7362, 260, 353, 7936, 198, 197, 1903, 7362, 7084, 257, 19163, 7084, 198, 197, 42400, 262, 914, 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...
4
func TestAutoIncrementPK(t *testing.T) { catalogStore, err := store.Open("catalog_auto_inc", store.DefaultOptions()) require.NoError(t, err) defer os.RemoveAll("catalog_auto_inc") dataStore, err := store.Open("sqldata_auto_inc", store.DefaultOptions()) require.NoError(t, err) defer os.RemoveAll("sqldata_auto_inc") engine, err := NewEngine(catalogStore, dataStore, DefaultOptions().WithPrefix(sqlPrefix)) require.NoError(t, err) _, err = engine.ExecStmt("CREATE DATABASE db1", nil, true) require.NoError(t, err) err = engine.UseDatabase("db1") require.NoError(t, err) t.Run("invalid use of auto-increment", func(t *testing.T) { _, err = engine.ExecStmt("CREATE TABLE table1 (id INTEGER, title VARCHAR AUTO_INCREMENT, PRIMARY KEY id)", nil, true) require.ErrorIs(t, err, ErrLimitedAutoIncrement) _, err = engine.ExecStmt("CREATE TABLE table1 (id INTEGER, title VARCHAR, age INTEGER AUTO_INCREMENT, PRIMARY KEY id)", nil, true) require.ErrorIs(t, err, ErrLimitedAutoIncrement) _, err = engine.ExecStmt("CREATE TABLE table1 (id VARCHAR AUTO_INCREMENT, title VARCHAR, PRIMARY KEY id)", nil, true) require.ErrorIs(t, err, ErrLimitedAutoIncrement) }) _, err = engine.ExecStmt("CREATE TABLE table1 (id INTEGER AUTO_INCREMENT, title VARCHAR, PRIMARY KEY id)", nil, true) require.NoError(t, err) summary, err := engine.ExecStmt("INSERT INTO table1(title) VALUES ('name1')", nil, true) require.NoError(t, err) require.Empty(t, summary.DDTxs) require.Len(t, summary.DMTxs, 1) require.Equal(t, uint64(1), summary.DMTxs[0].ID) require.Len(t, summary.LastInsertedPKs, 1) require.Equal(t, int64(1), summary.LastInsertedPKs["table1"]) require.Equal(t, 1, summary.UpdatedRows) _, err = engine.ExecStmt("INSERT INTO table1(id, title) VALUES (2, 'name2')", nil, true) require.ErrorIs(t, err, ErrNoValueForAutoIncrementalColumn) _, err = engine.ExecStmt("UPSERT INTO table1(id, title) VALUES (2, 'name2')", nil, true) require.ErrorIs(t, err, store.ErrKeyNotFound) _, err = engine.ExecStmt("UPSERT INTO table1(id, title) VALUES (1, 'name11')", nil, true) require.NoError(t, err) err = engine.ReloadCatalog(nil) require.NoError(t, err) summary, err = engine.ExecStmt("INSERT INTO table1(title) VALUES ('name2')", nil, true) require.NoError(t, err) require.Empty(t, summary.DDTxs) require.Len(t, summary.DMTxs, 1) require.Equal(t, uint64(3), summary.DMTxs[0].ID) require.Len(t, summary.LastInsertedPKs, 1) require.Equal(t, int64(2), summary.LastInsertedPKs["table1"]) require.Equal(t, 1, summary.UpdatedRows) summary, err = engine.ExecStmt(` BEGIN TRANSACTION INSERT INTO table1(title) VALUES ('name3'); INSERT INTO table1(title) VALUES ('name4'); COMMIT `, nil, true) require.NoError(t, err) require.Empty(t, summary.DDTxs) require.Len(t, summary.DMTxs, 1) require.Equal(t, uint64(4), summary.DMTxs[0].ID) require.Len(t, summary.LastInsertedPKs, 1) require.Equal(t, int64(4), summary.LastInsertedPKs["table1"]) require.Equal(t, 2, summary.UpdatedRows) }
explode_data.jsonl/64060
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1183 }
[ 2830, 3393, 13253, 38311, 22242, 1155, 353, 8840, 836, 8, 341, 1444, 7750, 6093, 11, 1848, 1669, 3553, 12953, 445, 26539, 27740, 31285, 497, 3553, 13275, 3798, 2398, 17957, 35699, 1155, 11, 1848, 340, 16867, 2643, 84427, 445, 26539, 27740...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_Setstat(t *testing.T) { if !isTestManual { t.Skipf("%s not set", envNameTestManual) } remoteFile := "/tmp/lib-ssh-sftp-setstat.test" fa := newFileAttrs() fa.SetPermissions(0766) fh, err := testClient.Create(remoteFile, fa) if err != nil { t.Fatal(err) } fa, err = testClient.Fstat(fh) if err != nil { t.Fatal(err) } exp := uint32(0o100600) fa.SetPermissions(exp) err = testClient.Setstat(remoteFile, fa) if err != nil { t.Fatal(err) } fa, err = testClient.Fstat(fh) if err != nil { t.Fatal(err) } test.Assert(t, "Setstat", exp, fa.Permissions()) }
explode_data.jsonl/66419
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 272 }
[ 2830, 3393, 2959, 14812, 9878, 1155, 353, 8840, 836, 8, 341, 743, 753, 285, 2271, 52092, 341, 197, 3244, 57776, 69, 4430, 82, 537, 738, 497, 6105, 675, 2271, 52092, 340, 197, 630, 197, 18147, 1703, 1669, 3521, 5173, 8194, 12, 25537, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestIDPHTTPCanHandleMetadataRequest(t *testing.T) { test := NewIdentifyProviderTest(t) w := httptest.NewRecorder() r, _ := http.NewRequest("GET", "https://idp.example.com/saml/metadata", nil) test.IDP.Handler().ServeHTTP(w, r) assert.Check(t, is.Equal(http.StatusOK, w.Code)) assert.Check(t, is.Equal("application/samlmetadata+xml", w.Header().Get("Content-type"))) assert.Check(t, strings.HasPrefix(string(w.Body.Bytes()), "<EntityDescriptor"), string(w.Body.Bytes())) }
explode_data.jsonl/19821
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 188 }
[ 2830, 3393, 915, 47, 9230, 6713, 6999, 14610, 1900, 1155, 353, 8840, 836, 8, 341, 18185, 1669, 1532, 28301, 1437, 5179, 2271, 1155, 340, 6692, 1669, 54320, 70334, 7121, 47023, 741, 7000, 11, 716, 1669, 1758, 75274, 445, 3806, 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 TestBackwardSeek(t *testing.T) { if lineSize != int64(len(entries[0])+1) { t.Fatal("test setup error: entries length doesn't match expected line size") } bufSize := len(file) buf := make([]byte, bufSize) vf := newTestValidationFile(entries) r, err := vf.Read(buf, 0, fs.WhenceFromCurrent) if err != nil { t.Fatalf("read failed: %s", err) } if r != len(file) { t.Fatalf("unexpected read length, expected %d, got %d", bufSize, r) } if err = compareBuffers(file, buf[:len(file)], 0, t); err != nil { t.Fatalf("%s", err) } secondReadSz := lineSize * 3 / 2 r, err = vf.Read(buf, 0-secondReadSz, fs.WhenceFromCurrent) if err != fs.ErrEOF { t.Fatalf("read expected EOF, but got: %s", err) } if int64(r) != secondReadSz { t.Fatalf("unexpected read length, expected %d, got %d", secondReadSz, r) } fileOffset := len(file) - int(secondReadSz) if err = compareBuffers(file[fileOffset:], buf[:secondReadSz], fileOffset, t); err != nil { t.Fatalf("%s", err) } }
explode_data.jsonl/16792
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 411 }
[ 2830, 3393, 3707, 1606, 39350, 1155, 353, 8840, 836, 8, 341, 743, 1555, 1695, 961, 526, 21, 19, 6901, 72009, 58, 15, 47966, 16, 8, 341, 197, 3244, 26133, 445, 1944, 6505, 1465, 25, 10695, 3084, 3171, 944, 2432, 3601, 1555, 1379, 113...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestLogsPathMatcher_VarLogContainers(t *testing.T) { cfgLogsPath := "/var/log/containers/" sourcePath := "/var/log/containers/kube-proxy-4d7nt_kube-system_kube-proxy-%s.log" if runtime.GOOS == "windows" { cfgLogsPath = "C:\\var\\log\\containers\\" sourcePath = "C:\\var\\log\\containers\\kube-proxy-4d7nt_kube-system_kube-proxy-%s.log" } source := fmt.Sprintf(sourcePath, cid) expectedResult := cid executeTest(t, cfgLogsPath, source, expectedResult) }
explode_data.jsonl/34418
{ "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, 51053, 1820, 37554, 61251, 2201, 74632, 1155, 353, 8840, 836, 8, 341, 50286, 51053, 1820, 1669, 3521, 947, 19413, 14, 39399, 29555, 47418, 1820, 1669, 3521, 947, 19413, 14, 39399, 14109, 3760, 83701, 12, 19, 67, 22, 406, 469...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestDeliverHeadersHang(t *testing.T) { testCases := []struct { protocol int syncMode SyncMode }{ {62, FullSync}, {63, FullSync}, {63, FastSync}, {64, FullSync}, {64, FastSync}, {64, LightSync}, } for _, tc := range testCases { t.Run(fmt.Sprintf("protocol %d mode %v", tc.protocol, tc.syncMode), func(t *testing.T) { testDeliverHeadersHang(t, tc.protocol, tc.syncMode) }) } }
explode_data.jsonl/33428
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 183 }
[ 2830, 3393, 16532, 1524, 10574, 57038, 1155, 353, 8840, 836, 8, 341, 18185, 37302, 1669, 3056, 1235, 341, 197, 197, 17014, 526, 198, 197, 1903, 1721, 3636, 28937, 3636, 198, 197, 59403, 197, 197, 90, 21, 17, 11, 8627, 12154, 1583, 197...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestTimestamppb(t *testing.T) { ctx, cancel := context.WithTimeout(testContext("Timestamppb"), 30*time.Second) defer cancel() const qry = `SELECT SYSDATE, :1, (SYSDATE-:2)*24*3600 FROM DUAL` it1, it2 := timestamppb.Now(), timestamppb.New(time.Now().Add(-10*time.Minute)) var ot1, ot2 sql.NullTime var on3 sql.NullInt64 if err := testDb.QueryRowContext(ctx, qry, it1, it2).Scan(&ot1, &ot2, &on3); err != nil { t.Fatalf("%s: %v", qry, err) } t.Logf("SYSDATE=%v 1=%v 2=%v", ot1, ot2, on3) }
explode_data.jsonl/17777
{ "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, 51, 4255, 45726, 65, 1155, 353, 8840, 836, 8, 341, 20985, 11, 9121, 1669, 2266, 26124, 7636, 8623, 1972, 445, 51, 4255, 45726, 65, 3975, 220, 18, 15, 77053, 32435, 340, 16867, 9121, 741, 4777, 68960, 284, 1565, 4858, 16079...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestMsgDeleteKpiFeatures_ValidateBasic(t *testing.T) { tests := []struct { name string msg MsgDeleteKpiFeatures err error }{ { name: "invalid address", msg: MsgDeleteKpiFeatures{ Creator: "invalid_address", }, err: sdkerrors.ErrInvalidAddress, }, { name: "valid address", msg: MsgDeleteKpiFeatures{ Creator: sample.AccAddress(), }, }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { err := tt.msg.ValidateBasic() if tt.err != nil { require.ErrorIs(t, err, tt.err) return } require.NoError(t, err) }) } }
explode_data.jsonl/72074
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 276 }
[ 2830, 3393, 6611, 6435, 42, 2493, 21336, 62, 17926, 15944, 1155, 353, 8840, 836, 8, 341, 78216, 1669, 3056, 1235, 341, 197, 11609, 914, 198, 197, 21169, 220, 24205, 6435, 42, 2493, 21336, 198, 197, 9859, 220, 1465, 198, 197, 59403, 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 TestBadConfigs(t *testing.T) { tests := []struct { cfg *AutomaticLoggingConfig }{ { cfg: &AutomaticLoggingConfig{}, }, { cfg: &AutomaticLoggingConfig{ Backend: "blarg", Spans: true, }, }, { cfg: &AutomaticLoggingConfig{ Backend: "logs", }, }, { cfg: &AutomaticLoggingConfig{ Backend: "loki", }, }, { cfg: &AutomaticLoggingConfig{ Backend: "stdout", }, }, } for _, tc := range tests { p, err := newTraceProcessor(&automaticLoggingProcessor{}, tc.cfg) require.Error(t, err) require.Nil(t, p) } }
explode_data.jsonl/73350
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 284 }
[ 2830, 3393, 17082, 84905, 1155, 353, 8840, 836, 8, 341, 78216, 1669, 3056, 1235, 341, 197, 50286, 353, 62790, 34575, 2648, 198, 197, 59403, 197, 197, 515, 298, 50286, 25, 609, 62790, 34575, 2648, 38837, 197, 197, 1583, 197, 197, 515, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestModuleFailsToInit(t *testing.T) { // Arrange logger, err := zap.NewDevelopment() require.NoError(t, err, "failed to get logger") config := getConfigWithAuthListener(t, []string{"auth"}, []int{1}, true) loader := loaderstest.MockLoader{} nModule := modulestest.MockModule{} nModule.On("Init", mock.Anything). Return(errors.New("failed to init")).Once() defer loader.AssertExpectations(t) loader.On("LoadModule", "module.auth.1").Return(&nModule, nil) // Act server, err := New(config, logger, &loader) // Assert assert.Nil(t, server) assert.Equal(t, err.Error(), "failed to init") }
explode_data.jsonl/59971
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 223 }
[ 2830, 3393, 3332, 37, 6209, 1249, 3803, 1155, 353, 8840, 836, 8, 341, 197, 322, 40580, 198, 17060, 11, 1848, 1669, 32978, 7121, 39419, 741, 17957, 35699, 1155, 11, 1848, 11, 330, 16091, 311, 633, 5925, 1138, 25873, 1669, 66763, 2354, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestEc2Instance_GetHighestUnusedDeviceIndex_NoFreeIndex(t *testing.T) { ctrl := gomock.NewController(t) defer ctrl.Finish() ec2Instance, _ := getMockInstance(ctrl) ec2Instance.deviceIndexes = []bool{true, true, true} _, err := ec2Instance.GetHighestUnusedDeviceIndex() assert.NotNil(t, err) }
explode_data.jsonl/760
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 113 }
[ 2830, 3393, 50730, 17, 2523, 13614, 96329, 94033, 6985, 1552, 36989, 10940, 1552, 1155, 353, 8840, 836, 8, 341, 84381, 1669, 342, 316, 1176, 7121, 2051, 1155, 340, 16867, 23743, 991, 18176, 2822, 197, 757, 17, 2523, 11, 716, 1669, 633, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestPartialSpanPropertiesFilter(t *testing.T) { opFilter, _ := newSpanPropertiesFilter(&operationNamePattern, nil, nil) durationFilter, _ := newSpanPropertiesFilter(nil, &minDuration, nil) spansFilter, _ := newSpanPropertiesFilter(nil, nil, &minNumberOfSpans) cases := []struct { Desc string Evaluator policyEvaluator }{ { Desc: "operation name filter", Evaluator: opFilter, }, { Desc: "duration filter", Evaluator: durationFilter, }, { Desc: "spans filter", Evaluator: spansFilter, }, } matchingTraces := newTraceAttrs("foobar", 1000*time.Microsecond, 100) nonMatchingTraces := newTraceAttrs("bar", 100*time.Microsecond, 1) for _, c := range cases { t.Run(c.Desc, func(t *testing.T) { u, _ := uuid.NewRandom() decision, err := c.Evaluator.Evaluate(pdata.NewTraceID(u), matchingTraces) assert.NoError(t, err) assert.Equal(t, decision, Sampled) u, _ = uuid.NewRandom() decision, err = c.Evaluator.Evaluate(pdata.NewTraceID(u), nonMatchingTraces) assert.NoError(t, err) assert.Equal(t, decision, NotSampled) }) } }
explode_data.jsonl/79887
{ "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, 37314, 12485, 7903, 5632, 1155, 353, 8840, 836, 8, 341, 39703, 5632, 11, 716, 1669, 501, 12485, 7903, 5632, 2099, 9262, 675, 15760, 11, 2092, 11, 2092, 340, 89300, 5632, 11, 716, 1669, 501, 12485, 7903, 5632, 27907, 11, 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...
1
func TestAlterFuncMap_tplinclude(t *testing.T) { c := &chart.Chart{ Metadata: &chart.Metadata{Name: "TplFunction"}, Templates: []*chart.File{ {Name: "templates/base", Data: []byte(`{{ tpl "{{include ` + "`" + `TplFunction/templates/_partial` + "`" + ` . | quote }}" .}}`)}, {Name: "templates/_partial", Data: []byte(`{{.Template.Name}}`)}, }, } v := chartutil.Values{ "Values": chartutil.Values{ "value": "myvalue", }, "Chart": c.Metadata, "Release": chartutil.Values{ "Name": "TestRelease", }, } out, err := Render(c, v) if err != nil { t.Fatal(err) } expect := "\"TplFunction/templates/base\"" if got := out["TplFunction/templates/base"]; got != expect { t.Errorf("Expected %q, got %q (%v)", expect, got, out) } }
explode_data.jsonl/74712
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 328 }
[ 2830, 3393, 74290, 9626, 2227, 14107, 997, 1155, 353, 8840, 836, 8, 341, 1444, 1669, 609, 15941, 42667, 515, 197, 9209, 7603, 25, 609, 15941, 46475, 63121, 25, 330, 87137, 5152, 7115, 197, 10261, 76793, 25, 29838, 15941, 8576, 515, 298,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestMissingNamespace(t *testing.T) { s := `<root> <myns:child id="1">value 1</myns:child> <myns:child id="2">value 2</myns:child> </root>` _, err := Parse(strings.NewReader(s)) if err == nil { t.Fatal("err is nil, want got invalid XML document") } }
explode_data.jsonl/18843
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 111 }
[ 2830, 3393, 25080, 22699, 1155, 353, 8840, 836, 8, 341, 1903, 1669, 30586, 2888, 397, 197, 13748, 1872, 82, 25, 3048, 877, 428, 16, 755, 957, 220, 16, 522, 76, 1872, 82, 25, 3048, 397, 197, 13748, 1872, 82, 25, 3048, 877, 428, 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...
2
func TestDivideSeries(t *testing.T) { now32 := int32(time.Now().Unix()) tests := []th.EvalTestItem{ { parser.NewExpr("divideSeries", "metric1", "metric2", ), map[parser.MetricRequest][]*types.MetricData{ {"metric1", 0, 1}: {types.MakeMetricData("metric1", []float64{1, math.NaN(), math.NaN(), 3, 4, 12}, 1, now32)}, {"metric2", 0, 1}: {types.MakeMetricData("metric2", []float64{2, math.NaN(), 3, math.NaN(), 0, 6}, 1, now32)}, }, []*types.MetricData{types.MakeMetricData("divideSeries(metric1,metric2)", []float64{0.5, math.NaN(), math.NaN(), math.NaN(), math.NaN(), 2}, 1, now32)}, }, { parser.NewExpr("divideSeries", "metric[12]", ), map[parser.MetricRequest][]*types.MetricData{ {"metric[12]", 0, 1}: { types.MakeMetricData("metric1", []float64{1, math.NaN(), math.NaN(), 3, 4, 12}, 1, now32), types.MakeMetricData("metric2", []float64{2, math.NaN(), 3, math.NaN(), 0, 6}, 1, now32), }, }, []*types.MetricData{types.MakeMetricData("divideSeries(metric[12])", []float64{0.5, math.NaN(), math.NaN(), math.NaN(), math.NaN(), 2}, 1, now32)}, }, } for _, tt := range tests { testName := tt.E.Target() + "(" + tt.E.RawArgs() + ")" t.Run(testName, func(t *testing.T) { th.TestEvalExpr(t, &tt) }) } }
explode_data.jsonl/47841
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 619 }
[ 2830, 3393, 12509, 577, 25544, 1155, 353, 8840, 836, 8, 341, 80922, 18, 17, 1669, 526, 18, 17, 9730, 13244, 1005, 55832, 12367, 78216, 1669, 3056, 339, 5142, 831, 2271, 1234, 515, 197, 197, 515, 298, 55804, 7121, 16041, 445, 59394, 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...
1
func TestMissingSpecificEnvironmentResultsInError(t *testing.T) { environments, err := environment.LoadEnvironmentList("test42", "../../cmd/monaco/test-resources/test-environments.yaml", util.NewFileReader()) assert.Assert(t, len(err) == 1, "Expected error from referencing unknown environment") assert.Assert(t, len(environments) == 0, "Expected to get empty environment map even on error") }
explode_data.jsonl/80401
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 114 }
[ 2830, 3393, 25080, 47514, 12723, 9801, 641, 1454, 1155, 353, 8840, 836, 8, 341, 197, 78291, 11, 1848, 1669, 4573, 13969, 12723, 852, 445, 1944, 19, 17, 497, 10208, 8710, 14, 1645, 16428, 12697, 89811, 12697, 20767, 17866, 33406, 497, 40...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestNamespace(t *testing.T) { resourceName := "pulsar_namespace.test" cName := acctest.RandString(10) tName := acctest.RandString(10) nsName := acctest.RandString(10) resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, Providers: testAccProviders, IDRefreshName: resourceName, CheckDestroy: testPulsarNamespaceDestroy, Steps: []resource.TestStep{ { Config: testPulsarNamespace(testWebServiceURL, cName, tName, nsName), Check: resource.ComposeTestCheckFunc( testPulsarNamespaceExists(resourceName), ), }, }, }) }
explode_data.jsonl/4689
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 244 }
[ 2830, 3393, 22699, 1155, 353, 8840, 836, 8, 1476, 50346, 675, 1669, 330, 79, 14295, 277, 41571, 5958, 698, 1444, 675, 1669, 1613, 67880, 2013, 437, 703, 7, 16, 15, 340, 3244, 675, 1669, 1613, 67880, 2013, 437, 703, 7, 16, 15, 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 TestSafeInlineLink(t *testing.T) { var tests = []string{ "[foo](/bar/)\n", "<p><a href=\"/bar/\">foo</a></p>\n", "[foo](http://bar/)\n", "<p><a href=\"http://bar/\">foo</a></p>\n", "[foo](https://bar/)\n", "<p><a href=\"https://bar/\">foo</a></p>\n", "[foo](ftp://bar/)\n", "<p><a href=\"ftp://bar/\">foo</a></p>\n", "[foo](mailto://bar/)\n", "<p><a href=\"mailto://bar/\">foo</a></p>\n", // Not considered safe "[foo](baz://bar/)\n", "<p><tt>foo</tt></p>\n", } doSafeTestsInline(t, tests) }
explode_data.jsonl/57356
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 266 }
[ 2830, 3393, 25663, 25324, 3939, 1155, 353, 8840, 836, 8, 341, 2405, 7032, 284, 3056, 917, 515, 197, 197, 36864, 7975, 9533, 14, 2257, 14, 10699, 77, 756, 197, 197, 22476, 79, 1784, 64, 1801, 98185, 2257, 14, 11403, 7975, 522, 64, 14...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestRevisitTimeQueueManager(t *testing.T) { var mutex sync.RWMutex m := initRevisitTimeQueueManager(&mutex, 0, 0, workerNoop) mutex.Lock() m.Push(&InMemKey{"3", time.Date(2100, 1, 1, 1, 3, 1, 0, time.Local)}) mutex.Unlock() mutex.Lock() m.Push(&InMemKey{"4", time.Date(2100, 1, 1, 1, 4, 1, 0, time.Local)}) mutex.Unlock() mutex.Lock() m.Push(&InMemKey{"2", time.Date(2100, 1, 1, 1, 2, 1, 0, time.Local)}) mutex.Unlock() mutex.Lock() m.Push(&InMemKey{"1", time.Date(2100, 1, 1, 1, 1, 1, 0, time.Local)}) mutex.Unlock() mutex.Lock() m.Push(&InMemKey{"5", time.Date(2100, 1, 1, 1, 5, 1, 0, time.Local)}) mutex.Unlock() m.Close() if m.revisitTimeQ[0].key != "1" { t.Fatalf("unexpected peek: %v", m.revisitTimeQ[0]) } i1 := heap.Pop(&m.revisitTimeQ).(*InMemKey) if i1.key != "1" { t.Fatalf("unexpected pop: %v", i1) } i2 := heap.Pop(&m.revisitTimeQ).(*InMemKey) if i2.key != "2" { t.Fatalf("unexpected pop: %v", i2) } i3 := heap.Pop(&m.revisitTimeQ).(*InMemKey) if i3.key != "3" { t.Fatalf("unexpected pop: %v", i3) } i4 := heap.Pop(&m.revisitTimeQ).(*InMemKey) if i4.key != "4" { t.Fatalf("unexpected pop: %v", i4) } i5 := heap.Pop(&m.revisitTimeQ).(*InMemKey) if i5.key != "5" { t.Fatalf("unexpected pop: %v", i5) } if len(m.revisitTimeQ) != 0 { t.Fatalf("unexpected len: %v", m.revisitTimeQ) } }
explode_data.jsonl/22717
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 677 }
[ 2830, 3393, 693, 27460, 1462, 7554, 2043, 1155, 353, 8840, 836, 8, 341, 2405, 30863, 12811, 2013, 15210, 9371, 198, 2109, 1669, 2930, 693, 27460, 1462, 7554, 2043, 2099, 22366, 11, 220, 15, 11, 220, 15, 11, 11864, 2753, 453, 340, 4262...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestTrans(t *testing.T) { var db = DB() var db2 = DB() var res Users db.Begin() db2.Table(&res).Select() t.Log(res) db.Commit() t.Log(res) }
explode_data.jsonl/60040
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 73 }
[ 2830, 3393, 3167, 1155, 353, 8840, 836, 8, 341, 2405, 2927, 284, 5952, 741, 2405, 2927, 17, 284, 5952, 741, 2405, 592, 14627, 198, 20939, 28467, 741, 20939, 17, 18257, 2099, 416, 568, 3379, 741, 3244, 5247, 4590, 340, 20939, 53036, 74...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestKpiMeasureGetAll(t *testing.T) { keeper, ctx := keepertest.PmKeeper(t) items := createNKpiMeasure(keeper, ctx, 10) require.ElementsMatch(t, items, keeper.GetAllKpiMeasure(ctx)) }
explode_data.jsonl/45266
{ "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, 42, 2493, 32236, 1949, 2403, 1155, 353, 8840, 836, 8, 341, 197, 18861, 11, 5635, 1669, 2506, 83386, 1069, 76, 77233, 1155, 340, 46413, 1669, 1855, 76180, 2493, 32236, 7, 18861, 11, 5635, 11, 220, 16, 15, 340, 17957, 68777,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestNew(t *testing.T) { t.Parallel() t.Run("test new - success", func(t *testing.T) { t.Parallel() record, err := New(mem.NewProvider()) require.NoError(t, err) require.NotNil(t, record) }) t.Run("test new - fail to open store", func(t *testing.T) { t.Parallel() record, err := New(&mockstorage.Provider{ErrOpenStore: errors.New("error opening the handler")}) require.Error(t, err) require.Contains(t, err.Error(), "error opening the handler") require.Nil(t, record) }) }
explode_data.jsonl/53337
{ "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, 3564, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 2822, 3244, 16708, 445, 1944, 501, 481, 2393, 497, 2915, 1155, 353, 8840, 836, 8, 341, 197, 3244, 41288, 7957, 2822, 197, 71952, 11, 1848, 1669, 1532, 39908, 7121, 517...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestProduceRequest(t *testing.T) { req := &ProduceReq{ CorrelationID: 241, ClientID: "test", RequiredAcks: RequiredAcksAll, Timeout: time.Second, Topics: []ProduceReqTopic{ { Name: "foo", Partitions: []ProduceReqPartition{ { ID: 0, Messages: []*Message{ { Offset: 0, Crc: 3099221847, Key: []byte("foo"), Value: []byte("bar"), }, }, }, }, }, }, } tests := []struct { Compression Compression Expected []byte }{ { CompressionNone, []byte{0x0, 0x0, 0x0, 0x49, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xf1, 0x0, 0x4, 0x74, 0x65, 0x73, 0x74, 0xff, 0xff, 0x0, 0x0, 0x3, 0xe8, 0x0, 0x0, 0x0, 0x1, 0x0, 0x3, 0x66, 0x6f, 0x6f, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x20, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x14, 0xb8, 0xba, 0x5f, 0x57, 0x0, 0x0, 0x0, 0x0, 0x0, 0x3, 0x66, 0x6f, 0x6f, 0x0, 0x0, 0x0, 0x3, 0x62, 0x61, 0x72}, }, { CompressionGzip, []byte{0x0, 0x0, 0x0, 0x6d, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xf1, 0x0, 0x4, 0x74, 0x65, 0x73, 0x74, 0xff, 0xff, 0x0, 0x0, 0x3, 0xe8, 0x0, 0x0, 0x0, 0x1, 0x0, 0x3, 0x66, 0x6f, 0x6f, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x44, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x38, 0x9d, 0x81, 0x74, 0xc4, 0x0, 0x1, 0xff, 0xff, 0xff, 0xff, 0x0, 0x0, 0x0, 0x2a, 0x1f, 0x8b, 0x8, 0x0, 0x0, 0x9, 0x6e, 0x88, 0x0, 0xff, 0x62, 0x40, 0x0, 0x91, 0x1d, 0xbb, 0xe2, 0xc3, 0xc1, 0x2c, 0xe6, 0xb4, 0xfc, 0x7c, 0x10, 0x95, 0x94, 0x58, 0x4, 0x8, 0x0, 0x0, 0xff, 0xff, 0xa0, 0xbc, 0x10, 0xc2, 0x20, 0x0, 0x0, 0x0}, }, { CompressionSnappy, []byte{0x0, 0x0, 0x0, 0x5c, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xf1, 0x0, 0x4, 0x74, 0x65, 0x73, 0x74, 0xff, 0xff, 0x0, 0x0, 0x3, 0xe8, 0x0, 0x0, 0x0, 0x1, 0x0, 0x3, 0x66, 0x6f, 0x6f, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x33, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x27, 0x2e, 0xd4, 0xed, 0xcd, 0x0, 0x2, 0xff, 0xff, 0xff, 0xff, 0x0, 0x0, 0x0, 0x19, 0x20, 0x0, 0x0, 0x19, 0x1, 0x10, 0x14, 0xb8, 0xba, 0x5f, 0x57, 0x5, 0xf, 0x28, 0x3, 0x66, 0x6f, 0x6f, 0x0, 0x0, 0x0, 0x3, 0x62, 0x61, 0x72}, }, } for _, tt := range tests { req.Compression = tt.Compression testRequestSerialization(t, req) b, _ := req.Bytes() if !bytes.Equal(b, tt.Expected) { fmt.Printf("%#v\n", tt.Expected) fmt.Printf("%#v\n", b) t.Fatalf("expected different bytes representation: %#v", b) } r, _ := ReadProduceReq(bytes.NewBuffer(tt.Expected)) req.Compression = CompressionNone // isn't set on deserialization if !reflect.DeepEqual(r, req) { t.Fatalf("malformed request: %#v", r) } } }
explode_data.jsonl/60403
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1736 }
[ 2830, 3393, 1336, 13373, 1900, 1155, 353, 8840, 836, 8, 341, 24395, 1669, 609, 1336, 13373, 27234, 515, 197, 6258, 269, 22221, 915, 25, 220, 17, 19, 16, 345, 197, 71724, 915, 25, 414, 330, 1944, 756, 197, 197, 8164, 32, 14553, 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...
4
func TestSupervisor_SingleService(t *testing.T) { cfg := &Config{ Logger: testr.NewTestLogger(t), } cfg.Services = append(cfg.Services, NewService("service1", func(ctx context.Context) error { <-ctx.Done() return nil })) _, done := newTestFixture(t, cfg) defer done() }
explode_data.jsonl/9756
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 110 }
[ 2830, 3393, 10048, 31396, 1098, 2173, 1860, 1155, 353, 8840, 836, 8, 341, 50286, 1669, 609, 2648, 515, 197, 55861, 25, 1273, 81, 7121, 2271, 7395, 1155, 1326, 197, 532, 50286, 20089, 284, 8737, 28272, 20089, 11, 1532, 1860, 445, 7936, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestJa3(t *testing.T) { for _, test := range ja3test { results, tls := testInit() reqData, err := hex.DecodeString(test.Packet) assert.NoError(t, err) tcpTuple := testTCPTuple() req := protos.Packet{Payload: reqData} var private protos.ProtocolData private = tls.Parse(&req, tcpTuple, 0, private) tls.ReceivedFin(tcpTuple, 0, private) assert.Len(t, results.events, 1) event := results.events[0] actual, err := event.Fields.GetValue("tls.fingerprints.ja3.str") assert.NoError(t, err) assert.Equal(t, test.Str, actual) actual, err = event.Fields.GetValue("tls.fingerprints.ja3.hash") assert.NoError(t, err) assert.Equal(t, test.Fingerprint, actual) } }
explode_data.jsonl/45625
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 288 }
[ 2830, 3393, 52445, 18, 1155, 353, 8840, 836, 8, 341, 2023, 8358, 1273, 1669, 2088, 11937, 18, 1944, 341, 197, 55497, 11, 55026, 1669, 1273, 3803, 741, 197, 24395, 1043, 11, 1848, 1669, 12371, 56372, 703, 8623, 93971, 340, 197, 6948, 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 TestParseModelAsTypeAlias(t *testing.T) { expected := `{ "swagger": "2.0", "info": { "description": "This is a sample server Petstore server.", "title": "Swagger Example API", "termsOfService": "http://swagger.io/terms/", "contact": { "name": "API Support", "url": "http://www.swagger.io/support", "email": "support@swagger.io" }, "license": { "name": "Apache 2.0", "url": "http://www.apache.org/licenses/LICENSE-2.0.html" }, "version": "1.0" }, "host": "petstore.swagger.io", "basePath": "/v2", "paths": { "/testapi/time-as-time-container": { "get": { "description": "test container with time and time alias", "consumes": [ "application/json" ], "produces": [ "application/json" ], "summary": "Get container with time and time alias", "operationId": "time-as-time-container", "responses": { "200": { "description": "ok", "schema": { "$ref": "#/definitions/data.TimeContainer" } } } } } }, "definitions": { "data.TimeContainer": { "type": "object", "properties": { "created_at": { "type": "string" }, "name": { "type": "string" }, "timestamp": { "type": "string" } } } } }` searchDir := "testdata/alias_type" p := New() err := p.ParseAPI(searchDir, mainAPIFile, defaultParseDepth) assert.NoError(t, err) b, _ := json.MarshalIndent(p.swagger, "", " ") assert.Equal(t, expected, string(b)) }
explode_data.jsonl/63559
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1192 }
[ 2830, 3393, 14463, 1712, 2121, 929, 22720, 1155, 353, 8840, 836, 8, 341, 42400, 1669, 1565, 515, 262, 330, 74755, 788, 330, 17, 13, 15, 756, 262, 330, 2733, 788, 341, 286, 330, 4684, 788, 330, 1986, 374, 264, 6077, 3538, 11333, 4314...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestACME(t *testing.T) { cert := genCert() logger := Logger(t, "Pebble") db := db.NewMemoryStore() ca := ca.New(logger, db) // Responding to challenges is tested in the integration test os.Setenv("PEBBLE_VA_ALWAYS_VALID", "1") os.Setenv("PEBBLE_VA_NOSLEEP", "1") // Enable strict mode to test upcoming API breaking changes strictMode := true va := va.New(logger, 80, 443, strictMode) wfeImpl := wfe.New(logger, db, va, ca, strictMode) muxHandler := wfeImpl.Handler() var tc tls.Config tc.Certificates = make([]tls.Certificate, 1) tc.Certificates[0] = cert l, err := net.Listen("tcp", "localhost:0") if err != nil { log.Fatalf("net.Listen failed: %v", err) } go func() { tl := tls.NewListener(l, &tc) if err := http.Serve(tl, muxHandler); err != nil { log.Fatalf("http.Serve failed: %v", err) } }() block := &pem.Block{ Type: "CERTIFICATE", Bytes: cert.Certificate[0], } fs := afero.NewMemMapFs() pk, _ := loadOrGenerateKey(fs, "account.key") m := &Manager{ FQDN: "ubmc.test", AccountKey: pk, ACMEHandlers: []ACMEHandler{&fakeACMEHandler{}}, ACMEConfig: &config.ACME{ Directory: fmt.Sprintf("https://%s/dir", l.Addr().String()), Contact: "mailto:nobody@localhost", TermsAgreed: true, APICA: string(pem.EncodeToMemory(block)), }, } now := time.Now() kp, err := m.maybeRenew(now, nil) if err != nil { t.Fatalf("Failed to load cert: %v", err) } // Try to renew just a bit after now = now.AddDate(0, 0, 1) kp2, err := m.maybeRenew(now, kp) if err != nil { t.Fatalf("Failed to load cert: %v", err) } if kp != kp2 { t.Fatalf("Certificate changed when it should not have, %v != %v", kp, kp2) } // Pebble mints 5 year certificates by default now = now.AddDate(5, 0, 0) kp2, err = m.maybeRenew(now, kp) if err != nil { t.Fatalf("Failed to load cert: %v", err) } if kp == kp2 { t.Fatalf("Certificate remained the same when it should have been renewed") } }
explode_data.jsonl/57926
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 855 }
[ 2830, 3393, 1706, 7462, 1155, 353, 8840, 836, 8, 341, 1444, 529, 1669, 4081, 36934, 741, 17060, 1669, 9514, 1155, 11, 330, 47, 3065, 891, 1138, 20939, 1669, 2927, 7121, 10642, 6093, 741, 197, 924, 1669, 2162, 7121, 37833, 11, 2927, 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...
2
func TestTransportPath(t *testing.T) { gotc := make(chan *url.URL, 1) st := newServerTester(t, func(w http.ResponseWriter, r *http.Request) { gotc <- r.URL }, optOnlyServer, ) defer st.Close() tr := &Transport{TLSClientConfig: tlsConfigInsecure} defer tr.CloseIdleConnections() const ( path = "/testpath" query = "q=1" ) surl := st.ts.URL + path + "?" + query req, err := http.NewRequest("POST", surl, nil) if err != nil { t.Fatal(err) } c := &http.Client{Transport: tr} res, err := c.Do(req) if err != nil { t.Fatal(err) } defer res.Body.Close() got := <-gotc if got.Path != path { t.Errorf("Read Path = %q; want %q", got.Path, path) } if got.RawQuery != query { t.Errorf("Read RawQuery = %q; want %q", got.RawQuery, query) } }
explode_data.jsonl/16053
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 342 }
[ 2830, 3393, 27560, 1820, 1155, 353, 8840, 836, 8, 341, 3174, 354, 66, 1669, 1281, 35190, 353, 1085, 20893, 11, 220, 16, 340, 18388, 1669, 501, 5475, 58699, 1155, 345, 197, 29244, 3622, 1758, 37508, 11, 435, 353, 1254, 9659, 8, 341, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestGetBlobSize(t *testing.T) { img := NewMatWithSize(100, 100, 5+16) defer img.Close() blob := BlobFromImage(img, 1.0, image.Pt(0, 0), NewScalar(0, 0, 0, 0), true, false) defer blob.Close() sz := GetBlobSize(blob) if sz.Val1 != 1 || sz.Val2 != 3 || sz.Val3 != 100 || sz.Val4 != 100 { t.Errorf("GetBlobSize retrieved wrong values") } }
explode_data.jsonl/31270
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 158 }
[ 2830, 3393, 1949, 37985, 1695, 1155, 353, 8840, 836, 8, 341, 39162, 1669, 1532, 11575, 2354, 1695, 7, 16, 15, 15, 11, 220, 16, 15, 15, 11, 220, 20, 10, 16, 21, 340, 16867, 4964, 10421, 2822, 2233, 1684, 1669, 49439, 3830, 1906, 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...
5
func TestWriteAndRead(t *testing.T) { kustomization := &types.Kustomization{ NamePrefix: "prefix", } fSys := fs.MakeFakeFS() fSys.WriteTestKustomization() mf, err := NewKustomizationFile(fSys) if err != nil { t.Fatalf("Unexpected Error: %v", err) } if err := mf.Write(kustomization); err != nil { t.Fatalf("Couldn't write kustomization file: %v\n", err) } content, err := mf.Read() if err != nil { t.Fatalf("Couldn't read kustomization file: %v\n", err) } kustomization.DealWithMissingFields() if !reflect.DeepEqual(kustomization, content) { t.Fatal("Read kustomization is different from written kustomization") } }
explode_data.jsonl/68517
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 248 }
[ 2830, 3393, 7985, 3036, 4418, 1155, 353, 8840, 836, 8, 341, 16463, 1450, 2022, 1669, 609, 9242, 11352, 1450, 2022, 515, 197, 21297, 14335, 25, 330, 11849, 756, 197, 630, 1166, 32792, 1669, 8619, 50133, 52317, 8485, 741, 1166, 32792, 407...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestValidatorBondHeight(t *testing.T) { app, ctx, addrs, _ := bootstrapValidatorTest(t, 1000, 20) // now 2 max resValidators params := app.StakingKeeper.GetParams(ctx) params.MaxValidators = 2 app.StakingKeeper.SetParams(ctx, params) // initialize some validators into the state var validators [3]types.Validator validators[0] = types.NewValidator(sdk.ValAddress(PKs[0].Address().Bytes()), PKs[0], types.Description{}) validators[1] = types.NewValidator(sdk.ValAddress(addrs[1]), PKs[1], types.Description{}) validators[2] = types.NewValidator(sdk.ValAddress(addrs[2]), PKs[2], types.Description{}) tokens0 := sdk.TokensFromConsensusPower(200) tokens1 := sdk.TokensFromConsensusPower(100) tokens2 := sdk.TokensFromConsensusPower(100) validators[0], _ = validators[0].AddTokensFromDel(tokens0) validators[1], _ = validators[1].AddTokensFromDel(tokens1) validators[2], _ = validators[2].AddTokensFromDel(tokens2) validators[0] = keeper.TestingUpdateValidator(app.StakingKeeper, ctx, validators[0], true) //////////////////////////////////////// // If two validators both increase to the same voting power in the same block, // the one with the first transaction should become bonded validators[1] = keeper.TestingUpdateValidator(app.StakingKeeper, ctx, validators[1], true) validators[2] = keeper.TestingUpdateValidator(app.StakingKeeper, ctx, validators[2], true) resValidators := app.StakingKeeper.GetBondedValidatorsByPower(ctx) require.Equal(t, uint32(len(resValidators)), params.MaxValidators) assert.True(ValEq(t, validators[0], resValidators[0])) assert.True(ValEq(t, validators[1], resValidators[1])) app.StakingKeeper.DeleteValidatorByPowerIndex(ctx, validators[1]) app.StakingKeeper.DeleteValidatorByPowerIndex(ctx, validators[2]) delTokens := sdk.TokensFromConsensusPower(50) validators[1], _ = validators[1].AddTokensFromDel(delTokens) validators[2], _ = validators[2].AddTokensFromDel(delTokens) validators[2] = keeper.TestingUpdateValidator(app.StakingKeeper, ctx, validators[2], true) resValidators = app.StakingKeeper.GetBondedValidatorsByPower(ctx) require.Equal(t, params.MaxValidators, uint32(len(resValidators))) validators[1] = keeper.TestingUpdateValidator(app.StakingKeeper, ctx, validators[1], true) assert.True(ValEq(t, validators[0], resValidators[0])) assert.True(ValEq(t, validators[2], resValidators[1])) }
explode_data.jsonl/6100
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 844 }
[ 2830, 3393, 14256, 89844, 3640, 1155, 353, 8840, 836, 8, 341, 28236, 11, 5635, 11, 912, 5428, 11, 716, 1669, 26925, 14256, 2271, 1155, 11, 220, 16, 15, 15, 15, 11, 220, 17, 15, 692, 197, 322, 1431, 220, 17, 1932, 592, 31748, 198, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_FileStore_All(t *testing.T) { storedir := "/tmp/TestStore/_all" f := NewFileStore(storedir) f.Open() pm := newPublishMsg(QOS_TWO, "/t/r/v", []byte{0x01, 0x02}) pm.setMsgId(121) key := obound_mid2key(pm.MsgId()) f.Put(key, pm) keys := f.All() if len(keys) != 1 { t.Fatalf("FileStore.All does not have the messages") } if keys[0] != "o.121" { t.Fatalf("FileStore.All has wrong key") } }
explode_data.jsonl/37288
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 190 }
[ 2830, 3393, 34061, 6093, 53629, 1155, 353, 8840, 836, 8, 341, 18388, 3018, 404, 1669, 3521, 5173, 80527, 6093, 19632, 541, 698, 1166, 1669, 1532, 1703, 6093, 5895, 3018, 404, 340, 1166, 12953, 741, 86511, 1669, 501, 50145, 6611, 6253, 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 TestFailureBadProcess(t *testing.T) { badProcessESSpan, err := loadESSpanFixture(1) require.NoError(t, err) badTags := []KeyValue{ { Key: "meh", Value: "", Type: "badType", }, } badProcessESSpan.Process = Process{ ServiceName: "hello", Tags: badTags, } failingSpanTransform(t, &badProcessESSpan, "not a valid ValueType string badType") }
explode_data.jsonl/5151
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 162 }
[ 2830, 3393, 17507, 17082, 7423, 1155, 353, 8840, 836, 8, 341, 2233, 329, 7423, 9996, 848, 11, 1848, 1669, 2795, 9996, 848, 18930, 7, 16, 340, 17957, 35699, 1155, 11, 1848, 692, 2233, 329, 15930, 1669, 3056, 72082, 515, 197, 197, 515, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestTidbClusterControllerUpdateStatefuSet(t *testing.T) { g := NewGomegaWithT(t) type testcase struct { name string updateSet func(*apps.StatefulSet) *apps.StatefulSet addTidbClusterToIndexer bool expectedLen int } testFn := func(test *testcase, t *testing.T) { t.Log("test: ", test.name) tc := newTidbCluster() set1 := newStatefuSet(tc) set2 := test.updateSet(set1) tcc, tcIndexer, _ := newFakeTidbClusterController() if test.addTidbClusterToIndexer { err := tcIndexer.Add(tc) g.Expect(err).NotTo(HaveOccurred()) } tcc.updateStatefuSet(set1, set2) g.Expect(tcc.queue.Len()).To(Equal(test.expectedLen)) } tests := []testcase{ { name: "normal", updateSet: func(set1 *apps.StatefulSet) *apps.StatefulSet { set2 := *set1 set2.ResourceVersion = "1000" return &set2 }, addTidbClusterToIndexer: true, expectedLen: 1, }, { name: "same resouceVersion", updateSet: func(set1 *apps.StatefulSet) *apps.StatefulSet { set2 := *set1 return &set2 }, addTidbClusterToIndexer: true, expectedLen: 0, }, { name: "without controllerRef", updateSet: func(set1 *apps.StatefulSet) *apps.StatefulSet { set2 := *set1 set2.ResourceVersion = "1000" set2.OwnerReferences = nil return &set2 }, addTidbClusterToIndexer: true, expectedLen: 0, }, { name: "without tidbcluster", updateSet: func(set1 *apps.StatefulSet) *apps.StatefulSet { set2 := *set1 set2.ResourceVersion = "1000" return &set2 }, addTidbClusterToIndexer: false, expectedLen: 0, }, } for i := range tests { testFn(&tests[i], t) } }
explode_data.jsonl/68175
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 840 }
[ 2830, 3393, 51, 307, 65, 28678, 2051, 4289, 1397, 32621, 1649, 1155, 353, 8840, 836, 8, 341, 3174, 1669, 1532, 38, 32696, 2354, 51, 1155, 340, 13158, 70080, 2036, 341, 197, 11609, 503, 914, 198, 197, 27175, 1649, 2290, 2915, 4071, 276...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestInt64DataPoint_StartTime(t *testing.T) { ms := NewInt64DataPoint() ms.InitEmpty() assert.EqualValues(t, TimestampUnixNano(0), ms.StartTime()) testValStartTime := TimestampUnixNano(1234567890) ms.SetStartTime(testValStartTime) assert.EqualValues(t, testValStartTime, ms.StartTime()) }
explode_data.jsonl/19530
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 110 }
[ 2830, 3393, 1072, 21, 19, 1043, 2609, 38056, 1462, 1155, 353, 8840, 836, 8, 341, 47691, 1669, 1532, 1072, 21, 19, 1043, 2609, 741, 47691, 26849, 3522, 741, 6948, 12808, 6227, 1155, 11, 32758, 55832, 83819, 7, 15, 701, 9829, 12101, 146...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestImportCardWithInvalidFaces(t *testing.T) { cases := []struct { name string fixture io.Reader wantContain string }{ { name: "ImportCardsWithInvalidFaces", fixture: fromFile(t, "testdata/card/cards_invalid_faces.json"), wantContain: "unprocessed double face cards", }, } for _, tc := range cases { t.Run(tc.name, func(t *testing.T) { setService := MockSetService{} cardService := MockCardService{} importer := NewImporter(&setService, &cardService) _, err := importer.Import(tc.fixture) if err == nil { t.Fatalf("expected import error to contain %v, got no error", tc.wantContain) } if len(cardService.Cards) != 0 { t.Fatalf("unexpected card count, got: %d, wanted 0", len(cardService.Cards)) } assert.Contains(t, err.Error(), tc.wantContain) }) } }
explode_data.jsonl/37503
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 351 }
[ 2830, 3393, 11511, 5770, 2354, 7928, 71940, 1155, 353, 8840, 836, 8, 341, 1444, 2264, 1669, 3056, 1235, 341, 197, 11609, 286, 914, 198, 197, 1166, 12735, 257, 6399, 47431, 198, 197, 50780, 46522, 914, 198, 197, 59403, 197, 197, 515, 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 TestValidate_KnownTypeNames_UnknownTypeNamesAreInValid(t *testing.T) { testutil.ExpectFailsRule(t, graphql.KnownTypeNamesRule, ` query Foo($var: JumbledUpLetters) { user(id: 4) { name pets { ... on Badger { name }, ...PetFields } } } fragment PetFields on Peettt { name } `, []gqlerrors.FormattedError{ testutil.RuleError(`Unknown type "JumbledUpLetters".`, 2, 23), testutil.RuleError(`Unknown type "Badger".`, 5, 25), testutil.RuleError(`Unknown type "Peettt". Did you mean "Pet"?`, 8, 29), }) }
explode_data.jsonl/59083
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 254 }
[ 2830, 3393, 17926, 10102, 4169, 929, 7980, 62, 13790, 929, 7980, 11526, 641, 4088, 1155, 353, 8840, 836, 8, 341, 18185, 1314, 81893, 37, 6209, 11337, 1155, 11, 48865, 11352, 4169, 929, 7980, 11337, 11, 22074, 414, 3239, 33428, 699, 947,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestStartStop(t *testing.T) { assert := assert.New(t) startGoroutineNum := runtime.NumGoroutine() for i := 0; i < 10; i++ { qa.Root(t, func(root string) { configFile := TestConfig(root) app := New(configFile) assert.NoError(app.ParseConfig()) assert.NoError(app.Start()) app.Stop() }) } endGoroutineNum := runtime.NumGoroutine() // GC worker etc if !assert.InDelta(startGoroutineNum, endGoroutineNum, 4) { p := pprof.Lookup("goroutine") p.WriteTo(os.Stdout, 1) } }
explode_data.jsonl/1753
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 213 }
[ 2830, 3393, 3479, 10674, 1155, 353, 8840, 836, 8, 341, 6948, 1669, 2060, 7121, 1155, 692, 21375, 38, 269, 14159, 4651, 1669, 15592, 39847, 38, 269, 14159, 2822, 2023, 600, 1669, 220, 15, 26, 600, 366, 220, 16, 15, 26, 600, 1027, 341...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestRenderHTML(t *testing.T) { defer leaktest.AfterTest(t)() cols := []string{"colname"} align := "d" rows := [][]string{ {"<b>foo</b>"}, {"bar"}, } type testCase struct { reporter htmlReporter out string } testCases := []testCase{ { reporter: htmlReporter{}, out: `<table> <thead><tr><th>colname</th></tr></thead> <tbody> <tr><td><b>foo</b></td></tr> <tr><td>bar</td></tr> </tbody> </table> `, }, { reporter: htmlReporter{escape: true}, out: `<table> <thead><tr><th>colname</th></tr></thead> <tbody> <tr><td>&lt;b&gt;foo&lt;/b&gt;</td></tr> <tr><td>bar</td></tr> </tbody> </table> `, }, { reporter: htmlReporter{rowStats: true}, out: `<table> <thead><tr><th>row</th><th>colname</th></tr></thead> <tbody> <tr><td>1</td><td><b>foo</b></td></tr> <tr><td>2</td><td>bar</td></tr> </tbody> <tfoot><tr><td colspan=2>2 rows</td></tr></tfoot></table> `, }, { reporter: htmlReporter{escape: true, rowStats: true}, out: `<table> <thead><tr><th>row</th><th>colname</th></tr></thead> <tbody> <tr><td>1</td><td>&lt;b&gt;foo&lt;/b&gt;</td></tr> <tr><td>2</td><td>bar</td></tr> </tbody> <tfoot><tr><td colspan=2>2 rows</td></tr></tfoot></table> `, }, } for _, tc := range testCases { name := fmt.Sprintf("escape=%v/rowStats=%v", tc.reporter.escape, tc.reporter.rowStats) t.Run(name, func(t *testing.T) { var buf bytes.Buffer err := render(&tc.reporter, &buf, cols, newRowSliceIter(rows, align), nil /* completedHook */, nil /* noRowsHook */) if err != nil { t.Fatal(err) } if tc.out != buf.String() { t.Errorf("expected:\n%s\ngot:\n%s", tc.out, buf.String()) } }) } }
explode_data.jsonl/33195
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 816 }
[ 2830, 3393, 6750, 5835, 1155, 353, 8840, 836, 8, 341, 16867, 23352, 1944, 36892, 2271, 1155, 8, 2822, 1444, 3069, 1669, 3056, 917, 4913, 2074, 606, 16707, 74051, 1669, 330, 67, 698, 68438, 1669, 52931, 917, 515, 197, 197, 4913, 27, 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 TestStrArray_PopRand(t *testing.T) { gtest.C(t, func(t *gtest.T) { a1 := []string{"0", "1", "2", "3", "4", "5", "6"} array1 := garray.NewStrArrayFrom(a1) str1, ok := array1.PopRand() t.Assert(strings.Contains("0,1,2,3,4,5,6", str1), true) t.Assert(array1.Len(), 6) t.Assert(ok, true) }) }
explode_data.jsonl/53106
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 158 }
[ 2830, 3393, 2580, 1857, 1088, 453, 56124, 1155, 353, 8840, 836, 8, 341, 3174, 1944, 727, 1155, 11, 2915, 1155, 353, 82038, 836, 8, 341, 197, 11323, 16, 1669, 3056, 917, 4913, 15, 497, 330, 16, 497, 330, 17, 497, 330, 18, 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 TestCheckPDFormerPodStatus(t *testing.T) { g := NewGomegaWithT(t) type testcase struct { stsReplicas int32 name string targetOrdinal int32 deleteSlots []int32 permit bool } tests := []testcase{ { stsReplicas: 5, name: "last target ordinal", targetOrdinal: 4, deleteSlots: []int32{}, permit: true, }, { stsReplicas: 5, name: "FirstTargetOrdinal", targetOrdinal: 0, deleteSlots: []int32{}, permit: true, }, { stsReplicas: 4, name: "mid target ordinal, check success", targetOrdinal: 1, deleteSlots: []int32{0}, permit: true, }, { stsReplicas: 4, name: "mid target ordinal, check success", targetOrdinal: 1, deleteSlots: []int32{2}, permit: true, }, } for _, test := range tests { t.Run(test.name, func(t *testing.T) { kubeCli, _ := newFakeComponent() pdControl := pdapi.NewFakePDControl(kubeCli) slots := sets.NewInt32(test.deleteSlots...) tc := newTidbClusterForPodAdmissionControl(test.stsReplicas, test.stsReplicas) fakePDClient := controller.NewFakePDClient(pdControl, tc) sts := buildTargetStatefulSet(tc, v1alpha1.PDMemberType) err := helper.SetDeleteSlots(sts, slots) g.Expect(err).NotTo(HaveOccurred()) healthInfo := &pdapi.HealthInfo{} for i := range helper.GetPodOrdinals(test.stsReplicas, sts) { healthInfo.Healths = append(healthInfo.Healths, pdapi.MemberHealth{ Name: memberUtils.PdName(tc.Name, i, tc.Namespace, tc.Spec.ClusterDomain), Health: true, }) pod := buildPod(tc, v1alpha1.PDMemberType, i) pod.Labels[apps.ControllerRevisionHashLabelKey] = sts.Status.UpdateRevision kubeCli.CoreV1().Pods(tc.Namespace).Create(pod) } fakePDClient.AddReaction(pdapi.GetHealthActionType, func(action *pdapi.Action) (interface{}, error) { return healthInfo, nil }) err = checkFormerPDPodStatus(kubeCli, fakePDClient, tc, sts, test.targetOrdinal) if test.permit { g.Expect(err).NotTo(HaveOccurred()) } else { g.Expect(err).Should(HaveOccurred()) } }) } }
explode_data.jsonl/75798
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 983 }
[ 2830, 3393, 3973, 23025, 30845, 23527, 2522, 1155, 353, 8840, 836, 8, 341, 3174, 1669, 1532, 38, 32696, 2354, 51, 1155, 340, 13158, 70080, 2036, 341, 197, 18388, 82, 18327, 52210, 256, 526, 18, 17, 198, 197, 11609, 688, 914, 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 TestServerServerCapabilities(t *testing.T) { WithObjs(t, []TCObj{CDNs, Types, Tenants, Parameters, Profiles, Statuses, Divisions, Regions, PhysLocations, CacheGroups, Servers, DeliveryServices, CacheGroupsDeliveryServices, ServerCapabilities, ServerServerCapabilities}, func() { GetTestServerServerCapabilities(t) }) }
explode_data.jsonl/69651
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 96 }
[ 2830, 3393, 5475, 5475, 55315, 1155, 353, 8840, 836, 8, 341, 197, 2354, 4121, 2519, 1155, 11, 3056, 7749, 5261, 90, 6484, 47360, 11, 20768, 11, 17695, 1783, 11, 13522, 11, 71727, 11, 8104, 288, 11, 8765, 6805, 11, 77347, 11, 12809, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestTagsUnmarshalEscapedQuote(t *testing.T) { c := NewComment() jsonData := []byte(`{"tags":["suc\"h", "wow"]}`) err := json.Unmarshal(jsonData, &c) if err != nil { t.Error(err) } got := c.Tags.All() expected := []string{"wow", "suc\"h"} if !equalSlices(expected, got) { t.Errorf("Tags are not the one that we expected them to be: got: %v, expected: %v", got, expected) } }
explode_data.jsonl/58855
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 162 }
[ 2830, 3393, 15930, 1806, 27121, 36121, 10185, 19466, 1155, 353, 8840, 836, 8, 341, 1444, 1669, 1532, 10677, 741, 30847, 1043, 1669, 3056, 3782, 5809, 4913, 14082, 36799, 82, 1754, 2105, 71, 497, 330, 57454, 1341, 27085, 9859, 1669, 2951, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestKey_signJWT(t *testing.T) { claims := &jwt.MapClaims{ "iss": "http://go.localhost.test", "iat": time.Now().Unix(), "exp": time.Now().Add(time.Second * 30).Unix(), "aud": "zebox/gojwk", "sub": "user_id", "email": "test@example.go", } k, err := NewKeys() require.NoError(t, err) err = k.Generate() require.NoError(t, err) assert.NotNil(t, k.publicKey) assert.NotNil(t, k.privateKey) tkn := jwt.NewWithClaims(jwt.SigningMethodRS256, claims) jwk, err := k.JWK() t.Log(jwk.ToString()) assert.NoError(t, err) assert.NotEmpty(t, jwk) tkn.Header["alg"] = jwk.Alg tkn.Header["kid"] = jwk.Kid tokenString, err := tkn.SignedString(k.Private()) require.NoError(t, err) assert.NotEmpty(t, tokenString) t.Log(tokenString) checkClaims := &jwt.MapClaims{} token, err := jwt.ParseWithClaims(tokenString, checkClaims, jwk.KeyFunc) assert.NoError(t, err) assert.NotNil(t, token) }
explode_data.jsonl/11412
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 417 }
[ 2830, 3393, 1592, 11172, 55172, 1155, 353, 8840, 836, 8, 1476, 197, 48561, 1669, 609, 41592, 10104, 51133, 515, 197, 197, 1, 1038, 788, 256, 330, 1254, 1110, 3346, 13, 8301, 5958, 756, 197, 197, 1, 10358, 788, 256, 882, 13244, 1005, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestMakeQuote(t *testing.T) { t.Parallel() if !areTestAPIKeysSet() || !canManipulateRealOrders { t.Skip("skipping test, either api keys or canManipulateRealOrders isnt set correctly") } _, err := f.MakeQuote(context.Background(), "1031", "5") if err != nil { t.Error(err) } }
explode_data.jsonl/15209
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 112 }
[ 2830, 3393, 8078, 19466, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 741, 743, 753, 546, 2271, 7082, 8850, 1649, 368, 1369, 753, 4814, 92876, 6334, 12768, 24898, 341, 197, 3244, 57776, 445, 4886, 5654, 1273, 11, 2987, 6330, 6894, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestDockerCoordinator_Remove_Cancel(t *testing.T) { t.Parallel() image := "foo" imageID := uuid.Generate() mapping := map[string]string{imageID: image} mock := newMockImageClient(mapping, 1*time.Millisecond) config := &dockerCoordinatorConfig{ logger: testlog.Logger(t), cleanup: true, client: mock, removeDelay: 100 * time.Millisecond, } // Create a coordinator coordinator := NewDockerCoordinator(config) callerID := uuid.Generate() // Pull image id, _ := coordinator.PullImage(image, nil, callerID, nil) // Check the reference count if references := coordinator.imageRefCount[id]; len(references) != 1 { t.Fatalf("Got reference count %d; want %d", len(references), 1) } // Remove image coordinator.RemoveImage(id, callerID) // Check the reference count if references := coordinator.imageRefCount[id]; len(references) != 0 { t.Fatalf("Got reference count %d; want %d", len(references), 0) } // Pull image again within delay id, _ = coordinator.PullImage(image, nil, callerID, nil) // Check the reference count if references := coordinator.imageRefCount[id]; len(references) != 1 { t.Fatalf("Got reference count %d; want %d", len(references), 1) } // Check that only no delete happened if removes := mock.removed[id]; removes != 0 { t.Fatalf("Image deleted when it shouldn't have") } }
explode_data.jsonl/63472
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 472 }
[ 2830, 3393, 35, 13659, 64304, 66843, 97485, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 741, 31426, 1669, 330, 7975, 698, 31426, 915, 1669, 16040, 57582, 741, 2109, 3629, 1669, 2415, 14032, 30953, 90, 1805, 915, 25, 2168, 630, 7733...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestEncodeSha1(t *testing.T) { assert.Equal(t, "8843d7f92416211de9ebb963ff4ce28125932878", EncodeSha1("foobar"), ) }
explode_data.jsonl/14308
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 69 }
[ 2830, 3393, 32535, 62316, 16, 1155, 353, 8840, 836, 8, 341, 6948, 12808, 1155, 345, 197, 197, 1, 23, 23, 19, 18, 67, 22, 69, 24, 17, 19, 16, 21, 17, 16, 16, 450, 24, 85302, 24, 21, 18, 542, 19, 346, 17, 23, 16, 17, 20, 24,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestTransportNoReuseAfterEarlyResponse(t *testing.T) { defer afterTest(t) var sconn struct { sync.Mutex c net.Conn } var getOkay bool closeConn := func() { sconn.Lock() defer sconn.Unlock() if sconn.c != nil { sconn.c.Close() sconn.c = nil if !getOkay { t.Logf("Closed server connection") } } } defer closeConn() ts := httptest.NewServer(HandlerFunc(func(w ResponseWriter, r *Request) { if r.Method == "GET" { io.WriteString(w, "bar") return } conn, _, _ := w.(Hijacker).Hijack() sconn.Lock() sconn.c = conn sconn.Unlock() conn.Write([]byte("HTTP/1.1 200 OK\r\nContent-Length: 3\r\n\r\nfoo")) // keep-alive go io.Copy(ioutil.Discard, conn) })) defer ts.Close() tr := &Transport{} defer tr.CloseIdleConnections() client := &Client{Transport: tr} const bodySize = 256 << 10 finalBit := make(byteFromChanReader, 1) req, _ := NewRequest("POST", ts.URL, io.MultiReader(io.LimitReader(neverEnding('x'), bodySize-1), finalBit)) req.ContentLength = bodySize res, err := client.Do(req) if err := wantBody(res, err, "foo"); err != nil { t.Errorf("POST response: %v", err) } donec := make(chan bool) go func() { defer close(donec) res, err = client.Get(ts.URL) if err := wantBody(res, err, "bar"); err != nil { t.Errorf("GET response: %v", err) return } getOkay = true // suppress test noise }() time.AfterFunc(5*time.Second, closeConn) select { case <-donec: finalBit <- 'x' // unblock the writeloop of the first Post close(finalBit) case <-time.After(7 * time.Second): t.Fatal("timeout waiting for GET request to finish") } }
explode_data.jsonl/4915
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 685 }
[ 2830, 3393, 27560, 2753, 38081, 6025, 41198, 2582, 1155, 353, 8840, 836, 8, 341, 16867, 1283, 2271, 1155, 340, 2405, 274, 5148, 2036, 341, 197, 1903, 1721, 99014, 198, 197, 1444, 4179, 50422, 198, 197, 532, 2405, 633, 32313, 1807, 198, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestTableOfContentsInShortcodes(t *testing.T) { t.Parallel() b := newMultiSiteTestDefaultBuilder(t) b.WithTemplatesAdded("layouts/shortcodes/toc.html", tocShortcode) b.WithContent("post/simple.en.md", tocPageSimple) b.WithContent("post/withSCInHeading.en.md", tocPageWithShortcodesInHeadings) b.CreateSites().Build(BuildCfg{}) b.AssertFileContent("public/en/post/simple/index.html", tocPageSimpleExpected) b.AssertFileContent("public/en/post/withSCInHeading/index.html", tocPageWithShortcodesInHeadingsExpected) }
explode_data.jsonl/16242
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 191 }
[ 2830, 3393, 2556, 2124, 14803, 641, 12472, 25814, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 2822, 2233, 1669, 501, 20358, 17597, 2271, 3675, 3297, 1155, 692, 2233, 26124, 51195, 19337, 445, 20054, 14, 8676, 25814, 5523, 509, 2564, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestTranslateIngressV1NoBackend(t *testing.T) { prefix := networkingv1.PathTypePrefix // no backend. ing := &networkingv1.Ingress{ ObjectMeta: metav1.ObjectMeta{ Name: "test", Namespace: "default", }, Spec: networkingv1.IngressSpec{ Rules: []networkingv1.IngressRule{ { Host: "apisix.apache.org", IngressRuleValue: networkingv1.IngressRuleValue{ HTTP: &networkingv1.HTTPIngressRuleValue{ Paths: []networkingv1.HTTPIngressPath{ { Path: "/foo", PathType: &prefix, }, }, }, }, }, }, }, } tr := &translator{} ctx, err := tr.translateIngressV1(ing) assert.Nil(t, err) assert.Len(t, ctx.Routes, 1) assert.Len(t, ctx.Upstreams, 0) assert.Len(t, ctx.PluginConfigs, 0) assert.Equal(t, "", ctx.Routes[0].UpstreamId) assert.Equal(t, "", ctx.Routes[0].PluginConfigId) assert.Equal(t, []string{"/foo", "/foo/*"}, ctx.Routes[0].Uris) }
explode_data.jsonl/6697
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 472 }
[ 2830, 3393, 27473, 641, 2483, 53, 16, 2753, 29699, 1155, 353, 8840, 836, 8, 341, 3223, 5060, 1669, 28030, 85, 16, 17474, 929, 14335, 198, 197, 322, 902, 19163, 624, 197, 287, 1669, 609, 17511, 287, 85, 16, 5337, 2483, 515, 197, 2381...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestCouchDbSourceStatusGetCondition(t *testing.T) { tests := []struct { name string s *CouchDbSourceStatus condQuery apis.ConditionType want *apis.Condition }{{ name: "uninitialized", s: &CouchDbSourceStatus{}, condQuery: CouchDbConditionReady, want: nil, }, { name: "initialized", s: func() *CouchDbSourceStatus { s := &CouchDbSourceStatus{} s.InitializeConditions() return s }(), condQuery: CouchDbConditionReady, want: &apis.Condition{ Type: CouchDbConditionReady, Status: corev1.ConditionUnknown, }, }, { name: "mark sink", s: func() *CouchDbSourceStatus { s := &CouchDbSourceStatus{} s.InitializeConditions() s.MarkSink("uri://example") return s }(), condQuery: CouchDbConditionReady, want: &apis.Condition{ Type: CouchDbConditionReady, Status: corev1.ConditionUnknown, }, }} for _, test := range tests { t.Run(test.name, func(t *testing.T) { got := test.s.GetCondition(test.condQuery) ignoreTime := cmpopts.IgnoreFields(apis.Condition{}, "LastTransitionTime", "Severity") if diff := cmp.Diff(test.want, got, ignoreTime); diff != "" { t.Errorf("unexpected condition (-want, +got) = %v", diff) } }) } }
explode_data.jsonl/64051
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 535 }
[ 2830, 3393, 34, 3026, 7994, 3608, 2522, 1949, 10547, 1155, 353, 8840, 836, 8, 341, 78216, 1669, 3056, 1235, 341, 197, 11609, 414, 914, 198, 197, 1903, 260, 353, 34, 3026, 7994, 3608, 2522, 198, 197, 197, 1297, 2859, 97723, 75134, 929,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_ListEip(t *testing.T) { args := &ListEipArgs{} result, err := EIP_CLIENT.ListEip(args) ExpectEqual(t.Errorf, nil, err) for _, e := range result.EipList { if e.Eip == EIP_ADDRESS { ExpectEqual(t.Errorf, "Postpaid", e.PaymentTiming) ExpectEqual(t.Errorf, "ByTraffic", e.BillingMethod) ExpectEqual(t.Errorf, 2, e.BandWidthInMbps) } } }
explode_data.jsonl/3038
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 172 }
[ 2830, 3393, 2959, 27104, 36, 573, 1155, 353, 8840, 836, 8, 341, 31215, 1669, 609, 852, 36, 573, 4117, 16094, 9559, 11, 1848, 1669, 468, 3298, 22521, 5814, 36, 573, 7356, 340, 35911, 2993, 1155, 13080, 11, 2092, 11, 1848, 340, 2023, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestQueryString(t *testing.T) { t.Parallel() c, s := makeClient(t, nil, nil) defer s.Stop() r, _ := c.newRequest("PUT", "/v1/abc?foo=bar&baz=zip") q := &WriteOptions{ Region: "foo", Namespace: "bar", } r.setWriteOptions(q) req, err := r.toHTTP() if err != nil { t.Fatalf("err: %s", err) } if uri := req.URL.RequestURI(); uri != "/v1/abc?baz=zip&foo=bar&namespace=bar&region=foo" { t.Fatalf("bad uri: %q", uri) } }
explode_data.jsonl/65023
{ "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, 67001, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 741, 1444, 11, 274, 1669, 1281, 2959, 1155, 11, 2092, 11, 2092, 340, 16867, 274, 30213, 2822, 7000, 11, 716, 1669, 272, 4618, 1900, 445, 6221, 497, 3521, 85, 16, 14...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestCountZeroBitsFromLeft(t *testing.T) { noZeroBits1 := make([]byte, 2) binary.BigEndian.PutUint16(noZeroBits1, 0xffff) fmt.Println("-- 1 --") zeroBitCount := CountZeroBitsFromLeft(noZeroBits1) if zeroBitCount != 0 { t.Errorf("0xffff should not have any zero bits") } oneZeroBit := make([]byte, 2) binary.BigEndian.PutUint16(oneZeroBit, 0x7fff) fmt.Println("-- 2 --") zeroBitCount = CountZeroBitsFromLeft(oneZeroBit) if zeroBitCount != 1 { t.Errorf("0x7fff should have one zero bit (from the left)") } twoZeroBits := make([]byte, 2) binary.BigEndian.PutUint16(twoZeroBits, 0x3fff) fmt.Println("-- 3 --") zeroBitCount = CountZeroBitsFromLeft(twoZeroBits) if zeroBitCount != 2 { t.Errorf("0x3fff should have two zero bits (from the left)") } notThreeZeroBits := make([]byte, 2) binary.BigEndian.PutUint16(notThreeZeroBits, 0x2fff) fmt.Println("-- 4 --") zeroBitCount = CountZeroBitsFromLeft(notThreeZeroBits) if zeroBitCount != 2 { t.Errorf("0x2fff should have two zero bits (from the left)") } }
explode_data.jsonl/82036
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 423 }
[ 2830, 3393, 2507, 17999, 19920, 3830, 5415, 1155, 353, 8840, 836, 8, 341, 72104, 17999, 19920, 16, 1669, 1281, 10556, 3782, 11, 220, 17, 340, 2233, 3287, 69223, 43231, 39825, 21570, 16, 21, 39205, 17999, 19920, 16, 11, 220, 15, 20518, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestOversizeCall(t *testing.T) { var ( ctx = context.Background() server = mustServer(t)(NewServer()) addr, listener = newTestListener(t) errs = make(chan error, 1) client, cleanup = newTestClient(t, addr) ) defer cleanup() defer listener.Close() go func() { errs <- server.Serve(ctx, listener) }() registerTestingService(server, &testingServer{}) tp := &internal.TestPayload{ Foo: strings.Repeat("a", 1+messageLengthMax), } if err := client.Call(ctx, serviceName, "Test", tp, tp); err == nil { t.Fatalf("expected error from non-existent service call") } else if status, ok := status.FromError(err); !ok { t.Fatalf("expected status present in error: %v", err) } else if status.Code() != codes.ResourceExhausted { t.Fatalf("expected code: %v != %v", status.Code(), codes.ResourceExhausted) } if err := server.Shutdown(ctx); err != nil { t.Fatal(err) } if err := <-errs; err != ErrServerClosed { t.Fatal(err) } }
explode_data.jsonl/41080
{ "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, 46, 3004, 551, 7220, 1155, 353, 8840, 836, 8, 341, 2405, 2399, 197, 20985, 1797, 284, 2266, 19047, 741, 197, 41057, 688, 284, 1969, 5475, 1155, 2376, 3564, 5475, 2398, 197, 53183, 11, 11446, 220, 284, 501, 2271, 2743, 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 TestHasAnyLabelDefined(t *testing.T) { testCases := []struct { rl ResultLabels want bool }{ { rl: ResultLabels{ AddOrUpdateLabel: "add-or-update", DestroyLabel: "destroy", NoChangesLabel: "no-changes", PlanErrorLabel: "error", }, want: true, }, { rl: ResultLabels{ AddOrUpdateLabel: "add-or-update", DestroyLabel: "destroy", NoChangesLabel: "", PlanErrorLabel: "error", }, want: true, }, { rl: ResultLabels{ AddOrUpdateLabel: "", DestroyLabel: "", NoChangesLabel: "", PlanErrorLabel: "", }, want: false, }, { rl: ResultLabels{}, want: false, }, } for _, testCase := range testCases { if testCase.rl.HasAnyLabelDefined() != testCase.want { t.Errorf("got %v but want %v", testCase.rl.HasAnyLabelDefined(), testCase.want) } } }
explode_data.jsonl/37418
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 415 }
[ 2830, 3393, 10281, 8610, 2476, 29361, 1155, 353, 8840, 836, 8, 341, 18185, 37302, 1669, 3056, 1235, 341, 197, 197, 2381, 256, 5714, 23674, 198, 197, 50780, 1807, 198, 197, 59403, 197, 197, 515, 298, 197, 2381, 25, 5714, 23674, 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...
3
func Test_flattenPolicyAssertion(t *testing.T) { roleName := dName + ":role.foo" resourceName := dName + ":foo_" ast.DeepEqual(t, flattenPolicyAssertion(getZmsAssertions(roleName, resourceName)), getFlattedAssertions("foo", "foo_")) }
explode_data.jsonl/80306
{ "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, 5081, 14456, 13825, 68639, 1155, 353, 8840, 836, 8, 341, 197, 5778, 675, 1669, 294, 675, 488, 13022, 5778, 58432, 698, 50346, 675, 1669, 294, 675, 488, 13022, 7975, 62, 698, 88836, 94750, 1155, 11, 45343, 13825, 68639, 5433,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestTableGetDestinations(t *testing.T) { peerT := DestCreatePeer() pathT := DestCreatePath(peerT) ipv4t := NewTable(bgp.RF_IPv4_UC) destinations := make(map[string]*Destination) for _, path := range pathT { tableKey := ipv4t.tableKey(path.GetNlri()) dest := NewDestination(path.GetNlri(), 0) destinations[tableKey] = dest } ipv4t.setDestinations(destinations) ds := ipv4t.GetDestinations() assert.Equal(t, ds, destinations) }
explode_data.jsonl/6677
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 179 }
[ 2830, 3393, 2556, 1949, 34830, 12634, 1155, 353, 8840, 836, 8, 341, 197, 16537, 51, 1669, 28531, 4021, 30888, 741, 26781, 51, 1669, 28531, 4021, 1820, 63372, 51, 340, 197, 42676, 19, 83, 1669, 1532, 2556, 1883, 21888, 2013, 37, 16607, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestBadProcess(t *testing.T) { logp.TestingSetup(logp.WithSelectors(processorName)) config, err := conf.NewConfigFrom(mapstr.M{ "match_pids": []string{"self_pid"}, "target": "self", }) if err != nil { t.Fatal(err) } proc, err := New(config) if err != nil { t.Fatal(err) } ev := beat.Event{ Fields: mapstr.M{ "self_pid": 0, }, } result, err := proc.Run(&ev) assert.Error(t, err) assert.NotNil(t, result) assert.NotNil(t, result.Fields) assert.Equal(t, ev.Fields, result.Fields) }
explode_data.jsonl/42534
{ "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, 17082, 7423, 1155, 353, 8840, 836, 8, 341, 6725, 79, 8787, 287, 21821, 12531, 79, 26124, 96995, 21929, 269, 675, 1171, 25873, 11, 1848, 1669, 2335, 7121, 2648, 3830, 9147, 495, 1321, 515, 197, 197, 1, 6347, 620, 3365, 788,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestNetworkContextWrite(t *testing.T) { cases := []struct { context Context expected string }{ // Errors { Context{Format: "{{InvalidFunction}}"}, `Template parsing error: template: :1: function "InvalidFunction" not defined `, }, { Context{Format: "{{nil}}"}, `Template parsing error: template: :1:2: executing "" at <nil>: nil is not a command `, }, // Table format { Context{Format: NewNetworkFormat("table", false)}, `NETWORK ID NAME DRIVER SCOPE networkID1 foobar_baz foo local networkID2 foobar_bar bar local `, }, { Context{Format: NewNetworkFormat("table", true)}, `networkID1 networkID2 `, }, { Context{Format: NewNetworkFormat("table {{.Name}}", false)}, `NAME foobar_baz foobar_bar `, }, { Context{Format: NewNetworkFormat("table {{.Name}}", true)}, `NAME foobar_baz foobar_bar `, }, // Raw Format { Context{Format: NewNetworkFormat("raw", false)}, `network_id: networkID1 name: foobar_baz driver: foo scope: local network_id: networkID2 name: foobar_bar driver: bar scope: local `, }, { Context{Format: NewNetworkFormat("raw", true)}, `network_id: networkID1 network_id: networkID2 `, }, // Custom Format { Context{Format: NewNetworkFormat("{{.Name}}", false)}, `foobar_baz foobar_bar `, }, // Custom Format with CreatedAt { Context{Format: NewNetworkFormat("{{.Name}} {{.CreatedAt}}", false)}, `foobar_baz 2016-01-01 00:00:00 +0000 UTC foobar_bar 2017-01-01 00:00:00 +0000 UTC `, }, } timestamp1, _ := time.Parse("2006-01-02", "2016-01-01") timestamp2, _ := time.Parse("2006-01-02", "2017-01-01") for _, testcase := range cases { networks := []types.NetworkResource{ {ID: "networkID1", Name: "foobar_baz", Driver: "foo", Scope: "local", Created: timestamp1}, {ID: "networkID2", Name: "foobar_bar", Driver: "bar", Scope: "local", Created: timestamp2}, } out := bytes.NewBufferString("") testcase.context.Output = out err := NetworkWrite(testcase.context, networks) if err != nil { assert.Error(t, err, testcase.expected) } else { assert.Check(t, is.Equal(testcase.expected, out.String())) } } }
explode_data.jsonl/62459
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 966 }
[ 2830, 3393, 12320, 1972, 7985, 1155, 353, 8840, 836, 8, 341, 1444, 2264, 1669, 3056, 1235, 341, 197, 28413, 220, 9608, 198, 197, 42400, 914, 198, 197, 92, 4257, 197, 197, 322, 39256, 198, 197, 197, 515, 298, 70871, 90, 4061, 25, 472...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestFailedConversion(t *testing.T) { defer func() { FailOnErr(Run("", "kubectl", "delete", "apiservice", "v1beta1.metrics.k8s.io")) }() testEdgeCasesApplicationResources(t, "failed-conversion", health.HealthStatusProgressing) }
explode_data.jsonl/66682
{ "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, 9408, 48237, 1155, 353, 8840, 836, 8, 1476, 16867, 2915, 368, 341, 197, 12727, 604, 1925, 7747, 2785, 359, 19814, 330, 79971, 497, 330, 4542, 497, 330, 13725, 1017, 497, 330, 85, 16, 19127, 16, 35359, 5202, 23, 82, 4245, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestMapProxy_ReplaceIfSameWithNilNewValue(t *testing.T) { _, err := mp.ReplaceIfSame("test", "test", nil) AssertErrorNotNil(t, err, "replaceIfSame did not return an error for nil newValue") mp.Clear() }
explode_data.jsonl/57004
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 77 }
[ 2830, 3393, 2227, 16219, 62, 23107, 2679, 19198, 2354, 19064, 3564, 1130, 1155, 353, 8840, 836, 8, 341, 197, 6878, 1848, 1669, 10490, 20858, 2679, 19198, 445, 1944, 497, 330, 1944, 497, 2092, 340, 18017, 1454, 96144, 1155, 11, 1848, 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
func TestCopyWithTarSrcFolder(t *testing.T) { folder, err := ioutil.TempDir("", "docker-archive-test") if err != nil { t.Fatal(err) } defer os.RemoveAll(folder) dest := filepath.Join(folder, "dest") src := filepath.Join(folder, filepath.Join("src", "folder")) err = os.MkdirAll(src, 0740) if err != nil { t.Fatal(err) } err = os.MkdirAll(dest, 0740) if err != nil { t.Fatal(err) } ioutil.WriteFile(filepath.Join(src, "file"), []byte("content"), 0777) err = CopyWithTar(src, dest) if err != nil { t.Fatalf("archiver.CopyWithTar shouldn't throw an error, %s.", err) } _, err = os.Stat(dest) // FIXME Check the content (the file inside) if err != nil { t.Fatalf("Destination folder should contain the source file but did not.") } }
explode_data.jsonl/81989
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 306 }
[ 2830, 3393, 12106, 2354, 62733, 20360, 13682, 1155, 353, 8840, 836, 8, 341, 1166, 2018, 11, 1848, 1669, 43144, 65009, 6184, 19814, 330, 28648, 95100, 16839, 1138, 743, 1848, 961, 2092, 341, 197, 3244, 26133, 3964, 340, 197, 532, 16867, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 Test_snmpSession_traceLog_enabled(t *testing.T) { config := checkconfig.CheckConfig{ IPAddress: "1.2.3.4", CommunityString: "abc", } var b bytes.Buffer w := bufio.NewWriter(&b) l, err := seelog.LoggerFromWriterWithMinLevelAndFormat(w, seelog.TraceLvl, "[%LEVEL] %FuncShort: %Msg") assert.Nil(t, err) log.SetupLogger(l, "trace") s, err := NewGosnmpSession(&config) gosnmpSess := s.(*GosnmpSession) assert.Nil(t, err) assert.NotNil(t, gosnmpSess.gosnmpInst.Logger) gosnmpSess.gosnmpInst.Logger.Print("log line 1") gosnmpSess.gosnmpInst.Logger.Print("log line 2") w.Flush() logs := b.String() assert.Contains(t, logs, "log line 1") assert.Contains(t, logs, "log line 2") }
explode_data.jsonl/59175
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 318 }
[ 2830, 3393, 28022, 1307, 5283, 23575, 2201, 18220, 1155, 353, 8840, 836, 8, 341, 25873, 1669, 1779, 1676, 10600, 2648, 515, 197, 197, 87976, 25, 981, 330, 16, 13, 17, 13, 18, 13, 19, 756, 197, 197, 33768, 703, 25, 330, 13683, 756, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestListenShutdown(t *testing.T) { c := context.New(t, defaultMTU) defer c.Cleanup() c.Create(-1 /* epRcvBuf */) if err := c.EP.Bind(tcpip.FullAddress{Port: context.StackPort}); err != nil { t.Fatal("Bind failed:", err) } if err := c.EP.Listen(1 /* backlog */); err != nil { t.Fatal("Listen failed:", err) } if err := c.EP.Shutdown(tcpip.ShutdownRead); err != nil { t.Fatal("Shutdown failed:", err) } c.SendPacket(nil, &context.Headers{ SrcPort: context.TestPort, DstPort: context.StackPort, Flags: header.TCPFlagSyn, SeqNum: 100, AckNum: 200, }) // Expect the listening endpoint to reset the connection. checker.IPv4(t, c.GetPacket(), checker.TCP( checker.DstPort(context.TestPort), checker.TCPFlags(header.TCPFlagAck|header.TCPFlagRst), )) }
explode_data.jsonl/75941
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 340 }
[ 2830, 3393, 38714, 62004, 1155, 353, 8840, 836, 8, 341, 1444, 1669, 2266, 7121, 1155, 11, 1638, 8505, 52, 340, 16867, 272, 727, 60639, 2822, 1444, 7251, 4080, 16, 1391, 4155, 49, 13122, 15064, 639, 692, 743, 1848, 1669, 272, 5142, 47,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestUserAccessTokenDisableConfig(t *testing.T) { th := Setup(t).InitBasic() defer th.TearDown() testDescription := "test token" th.App.UpdateConfig(func(cfg *model.Config) { *cfg.ServiceSettings.EnableUserAccessTokens = true }) th.App.UpdateUserRoles(th.BasicUser.Id, model.SystemUserRoleId+" "+model.SystemUserAccessTokenRoleId, false) token, _, err := th.Client.CreateUserAccessToken(th.BasicUser.Id, testDescription) require.NoError(t, err) oldSessionToken := th.Client.AuthToken th.Client.AuthToken = token.Token _, _, err = th.Client.GetMe("") require.NoError(t, err) th.App.UpdateConfig(func(cfg *model.Config) { *cfg.ServiceSettings.EnableUserAccessTokens = false }) _, resp, err := th.Client.GetMe("") require.Error(t, err) CheckUnauthorizedStatus(t, resp) th.Client.AuthToken = oldSessionToken _, _, err = th.Client.GetMe("") require.NoError(t, err) }
explode_data.jsonl/47554
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 314 }
[ 2830, 3393, 1474, 37649, 25479, 2648, 1155, 353, 8840, 836, 8, 341, 70479, 1669, 18626, 1155, 568, 3803, 15944, 741, 16867, 270, 836, 682, 4454, 2822, 18185, 5009, 1669, 330, 1944, 3950, 1837, 70479, 5105, 16689, 2648, 18552, 28272, 353, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestMuxEmptyParams(t *testing.T) { r := NewRouter() r.Get(`/users/{x}/{y}/{z}`, func(w http.ResponseWriter, r *http.Request) { x := URLParam(r, "x") y := URLParam(r, "y") z := URLParam(r, "z") w.Write([]byte(fmt.Sprintf("%s-%s-%s", x, y, z))) }) ts := httptest.NewServer(r) defer ts.Close() if _, body := testRequest(t, ts, "GET", "/users/a/b/c", nil); body != "a-b-c" { t.Fatalf(body) } if _, body := testRequest(t, ts, "GET", "/users///c", nil); body != "--c" { t.Fatalf(body) } }
explode_data.jsonl/42884
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 251 }
[ 2830, 3393, 44, 2200, 3522, 4870, 1155, 353, 8840, 836, 8, 341, 7000, 1669, 1532, 9523, 741, 7000, 2234, 31813, 4218, 9388, 87, 22472, 88, 22472, 89, 28350, 2915, 3622, 1758, 37508, 11, 435, 353, 1254, 9659, 8, 341, 197, 10225, 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 TestPathDebug(t *testing.T) { fixture := node{ Value: nodeValue{Value: 3}, Children: []node{ {Ref: &node{Value: nodeValue{Value: 9}}}, }, Labels: map[string]node{ "label1": {}, }, } gocmp.Equal(fixture, fixture, gocmp.FilterPath(PathDebug, gocmp.Ignore())) }
explode_data.jsonl/34721
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 126 }
[ 2830, 3393, 1820, 7939, 1155, 353, 8840, 836, 8, 341, 1166, 12735, 1669, 2436, 515, 197, 47399, 25, 2436, 1130, 90, 1130, 25, 220, 18, 1583, 197, 197, 11539, 25, 3056, 3509, 515, 298, 197, 90, 3945, 25, 609, 3509, 90, 1130, 25, 24...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestParseKeyArg(t *testing.T) { if parsed, err := parseKeyArg(""); len(parsed) != 0 || err != nil { t.Errorf("Parsing an empty string into a keys arg should yield an empty slice") return } if parsed, err := parseKeyArg("my-key"); err != nil || len(parsed) != 1 || parsed[0].db != "0" || parsed[0].key != "my-key" { t.Errorf("Expected DB: 0 and key: my-key, got: %#v", parsed[0]) return } if _, err := parseKeyArg("wrong=wrong=wrong"); err == nil { t.Errorf("Expected an error") return } }
explode_data.jsonl/46987
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 200 }
[ 2830, 3393, 14463, 1592, 2735, 1155, 353, 8840, 836, 8, 341, 743, 15676, 11, 1848, 1669, 4715, 1592, 2735, 97918, 2422, 48462, 8, 961, 220, 15, 1369, 1848, 961, 2092, 341, 197, 3244, 13080, 445, 68839, 458, 4287, 914, 1119, 264, 6894,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestResourceGroupCoveringEnumerated(t *testing.T) { escalationTest{ ownerRules: []authorizationapi.PolicyRule{ {Verbs: sets.NewString("create", "delete", "update"), Resources: sets.NewString("resourcegroup:builds")}, }, servantRules: []authorizationapi.PolicyRule{ {Verbs: sets.NewString("delete", "update"), Resources: sets.NewString("builds", "buildconfigs")}, }, expectedCovered: true, expectedUncoveredRules: []authorizationapi.PolicyRule{}, }.test(t) }
explode_data.jsonl/9047
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 171 }
[ 2830, 3393, 4783, 2808, 30896, 287, 5882, 657, 1155, 353, 8840, 836, 8, 341, 80629, 278, 367, 2271, 515, 197, 197, 8118, 26008, 25, 3056, 39554, 2068, 1069, 8018, 11337, 515, 298, 197, 90, 10141, 1279, 25, 7289, 7121, 703, 445, 3182, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestGetAddressBalance(t *testing.T) { ltcAddress := "LdP8Qox1VAhCzLJNqrr74YovaWYyNBUWvL" ltc := "ltc" description := "Description of Wallet" balance := float64(1000) portfolio := Base{} portfolio.AddAddress(ltcAddress, ltc, description, balance) addBalance, _ := portfolio.GetAddressBalance("LdP8Qox1VAhCzLJNqrr74YovaWYyNBUWvL", ltc, description) if addBalance != balance { t.Error("Test Failed - Portfolio GetAddressBalance() Error: Incorrect value") } addBalance, found := portfolio.GetAddressBalance("WigWham", ltc, description) if addBalance != 0 { t.Error("Test Failed - Portfolio GetAddressBalance() Error: Incorrect value") } if found != false { t.Error("Test Failed - Portfolio GetAddressBalance() Error: Incorrect value") } }
explode_data.jsonl/33732
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 271 }
[ 2830, 3393, 1949, 4286, 21190, 1155, 353, 8840, 836, 8, 341, 197, 4832, 66, 4286, 1669, 330, 43, 67, 47, 23, 48, 5131, 16, 12820, 71, 34, 89, 43, 41, 45, 80, 634, 22, 19, 56, 12660, 54, 56, 88, 45, 14928, 54, 85, 43, 698, 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 TestHealthcheckNone(t *testing.T) { b := &Builder{flags: &BFlags{}, runConfig: &container.Config{}, disableCommit: true} if err := healthcheck(b, []string{"NONE"}, nil, ""); err != nil { t.Fatalf("Error should be empty, got: %s", err.Error()) } if b.runConfig.Healthcheck == nil { t.Fatal("Healthcheck should be set, got nil") } expectedTest := strslice.StrSlice(append([]string{"NONE"})) if !compareStrSlice(expectedTest, b.runConfig.Healthcheck.Test) { t.Fatalf("Command should be set to %s, got %s", expectedTest, b.runConfig.Healthcheck.Test) } }
explode_data.jsonl/28281
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 207 }
[ 2830, 3393, 14542, 2028, 4064, 1155, 353, 8840, 836, 8, 341, 2233, 1669, 609, 3297, 90, 11161, 25, 609, 33, 9195, 22655, 1598, 2648, 25, 609, 3586, 10753, 22655, 11156, 33441, 25, 830, 630, 743, 1848, 1669, 2820, 2028, 1883, 11, 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...
4
func TestTagMissingQuote(t *testing.T) { var opts = struct { Value bool `short:"v` }{} assertParseFail(t, ErrTag, "expected end of tag value `\"' at end of tag (in `short:\"v`)", &opts, "") }
explode_data.jsonl/44077
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 84 }
[ 2830, 3393, 5668, 25080, 19466, 1155, 353, 8840, 836, 8, 972, 2405, 12185, 284, 2036, 972, 197, 47399, 1807, 1565, 8676, 2974, 85, 75679, 197, 15170, 2570, 6948, 14463, 19524, 1155, 11, 15495, 5668, 11, 330, 7325, 835, 315, 4772, 897, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestWithdrawCrypto(t *testing.T) { t.Parallel() _, err := b.WithdrawCrypto(0, "BTC", "LOLOLOL") if err == nil { t.Error("Test failed - WithdrawCrypto() error", err) } }
explode_data.jsonl/48995
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 76 }
[ 2830, 3393, 92261, 58288, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 741, 197, 6878, 1848, 1669, 293, 26124, 7633, 58288, 7, 15, 11, 330, 59118, 497, 330, 1593, 1593, 1593, 43, 1138, 743, 1848, 621, 2092, 341, 197, 3244, 6141, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestGetPlatform(t *testing.T) { t.Parallel() cleanupTerraformFolder(t, TEST_FIXTURE_GET_PLATFORM) tmpEnvPath := copyEnvironment(t, TEST_FIXTURE_GET_PLATFORM) rootPath := util.JoinPath(tmpEnvPath, TEST_FIXTURE_GET_PLATFORM) runTerragrunt(t, fmt.Sprintf("terragrunt apply-all --terragrunt-non-interactive --terragrunt-working-dir %s", rootPath)) // verify expected outputs are not empty stdout := bytes.Buffer{} stderr := bytes.Buffer{} require.NoError( t, runTerragruntCommand(t, fmt.Sprintf("terragrunt output -no-color -json --terragrunt-non-interactive --terragrunt-working-dir %s", rootPath), &stdout, &stderr), ) outputs := map[string]TerraformOutput{} require.NoError(t, json.Unmarshal([]byte(stdout.String()), &outputs)) platform, hasPlatform := outputs["platform"] require.True(t, hasPlatform) require.Equal(t, platform.Value, runtime.GOOS) }
explode_data.jsonl/10150
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 335 }
[ 2830, 3393, 1949, 17296, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 2822, 1444, 60639, 51, 13886, 627, 13682, 1155, 11, 13602, 42635, 41486, 12702, 43219, 340, 20082, 14359, 1820, 1669, 2975, 12723, 1155, 11, 13602, 42635, 41486, 12...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestDev(t *testing.T) { if !*oDev { t.Log("use -dev to enable") return } *oOut = *oDevOut if s := *oSrc; s != "" { err := main1(s) if err != nil { t.Fatal(err) } } }
explode_data.jsonl/45897
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 100 }
[ 2830, 3393, 14592, 1155, 353, 8840, 836, 8, 341, 743, 753, 9, 78, 14592, 341, 197, 3244, 5247, 445, 810, 481, 3583, 311, 7283, 1138, 197, 853, 198, 197, 630, 197, 9, 78, 2662, 284, 353, 78, 14592, 2662, 198, 743, 274, 1669, 353, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestProjectCreate(t *testing.T) { ctx := context.Background() createCalled := false updateCalled := false prov := sentryProvider{ sentryClient: &sentryClientMock{ createProject: func(org sentry.Organization, team sentry.Team, name string, slug *string) (sentry.Project, error) { assert.Equal(t, *org.Slug, "the-org") assert.Equal(t, *team.Slug, "the-team") assert.Equal(t, name, "a name") assert.Equal(t, *slug, "slug") createCalled = true return sentry.Project{ Name: "name-from-create", Slug: stringPtr("slug-from-create"), }, nil }, updateProject: func(org sentry.Organization, proj sentry.Project) error { assert.True(t, createCalled) assert.Equal(t, *proj.DefaultEnvironment, "env name") assert.Equal(t, *proj.SubjectPrefix, "subject prefix") assert.Equal(t, *proj.SubjectTemplate, "subject template") assert.Equal(t, *proj.DefaultEnvironment, "env name") updateCalled = true return nil }, getClientKeys: func(o sentry.Organization, p sentry.Project) ([]sentry.Key, error) { return []sentry.Key{ {Label: "Default", DSN: sentry.DSN{Public: "public-dsn"}}, }, nil }, }, } inputs := resource.PropertyMap{ "defaultEnvironment": resource.NewPropertyValue("env name"), "name": resource.NewPropertyValue("a name"), "organizationSlug": resource.NewPropertyValue("the-org"), "slug": resource.NewPropertyValue("slug"), "subjectPrefix": resource.NewPropertyValue("subject prefix"), "subjectTemplate": resource.NewPropertyValue("subject template"), "teamSlug": resource.NewPropertyValue("the-team"), } resp, err := prov.projectCreate(ctx, &rpc.CreateRequest{}, inputs) assert.Nil(t, err) assert.True(t, updateCalled) assert.Equal(t, resp.GetId(), "the-org/slug-from-create") assert.Equal(t, mustUnmarshalProperties(resp.GetProperties()), resource.PropertyMap{ "defaultEnvironment": resource.NewPropertyValue("env name"), "name": resource.NewPropertyValue("name-from-create"), "organizationSlug": resource.NewPropertyValue("the-org"), "slug": resource.NewPropertyValue("slug-from-create"), "teamSlug": resource.NewPropertyValue("the-team"), "subjectPrefix": resource.NewPropertyValue("subject prefix"), "subjectTemplate": resource.NewPropertyValue("subject template"), "defaultClientKeyDSNPublic": resource.NewPropertyValue("public-dsn"), }) }
explode_data.jsonl/27972
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1021 }
[ 2830, 3393, 7849, 4021, 1155, 353, 8840, 836, 8, 341, 20985, 1669, 2266, 19047, 741, 39263, 20960, 1669, 895, 198, 27175, 20960, 1669, 895, 198, 197, 42947, 1669, 3208, 884, 5179, 515, 197, 1903, 4085, 2959, 25, 609, 82, 4085, 2959, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestConfigCopy(t *testing.T) { // cfg and origCfg are declared in an identical way. It's not // possible to take a shallow copy since cfg must absolutely // not change as it's used for the reflect.DeepEqual comparison. cfg := mergeDefaults(&NilConfig{ RequestTimeout: &Duration{10 * time.Second}, SleepInterval: &Duration{10 * time.Second}, KeeperFailInterval: &Duration{100 * time.Second}, MaxStandbysPerSender: UintP(5), SynchronousReplication: BoolP(true), InitWithMultipleKeepers: BoolP(true), PGParameters: &map[string]string{ "param01": "value01", }, }).ToConfig() origCfg := mergeDefaults(&NilConfig{ RequestTimeout: &Duration{10 * time.Second}, SleepInterval: &Duration{10 * time.Second}, KeeperFailInterval: &Duration{100 * time.Second}, MaxStandbysPerSender: UintP(5), SynchronousReplication: BoolP(true), InitWithMultipleKeepers: BoolP(true), PGParameters: &map[string]string{ "param01": "value01", }, }).ToConfig() // Now take a origCfg copy, change all its fields and check that origCfg isn't changed newCfg := origCfg.Copy() newCfg.RequestTimeout = 20 * time.Second newCfg.SleepInterval = 20 * time.Second newCfg.KeeperFailInterval = 20 * time.Second newCfg.MaxStandbysPerSender = 10 newCfg.SynchronousReplication = false newCfg.InitWithMultipleKeepers = false newCfg.PGParameters["param01"] = "anothervalue01" if !reflect.DeepEqual(origCfg, cfg) { t.Errorf("Original config shouldn't be changed") } }
explode_data.jsonl/26736
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 583 }
[ 2830, 3393, 2648, 12106, 1155, 353, 8840, 836, 8, 341, 197, 322, 13286, 323, 2713, 42467, 525, 14275, 304, 458, 19516, 1616, 13, 1084, 594, 537, 198, 197, 322, 3204, 311, 1896, 264, 25600, 2975, 2474, 13286, 1969, 10875, 198, 197, 322...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestConfigMapNotControlledByUs(t *testing.T) { f := newFixture(t) startTime := metav1.Now() completionTime := metav1.Now() var replicas int32 = 64 mpiJob := newMPIJob("test", &replicas, 1, gpuResourceName, &startTime, &completionTime) f.setUpMPIJob(mpiJob) configMap := newConfigMap(mpiJob, replicas, isGPULauncher(mpiJob)) updateDiscoverHostsInConfigMap(configMap, mpiJob, nil, isGPULauncher(mpiJob)) configMap.OwnerReferences = nil f.setUpConfigMap(configMap) f.runExpectError(getKey(mpiJob, t)) }
explode_data.jsonl/29954
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 200 }
[ 2830, 3393, 2648, 2227, 2623, 3273, 832, 1359, 3558, 1155, 353, 8840, 836, 8, 341, 1166, 1669, 501, 18930, 1155, 340, 21375, 1462, 1669, 77520, 16, 13244, 741, 32810, 14386, 1462, 1669, 77520, 16, 13244, 2822, 2405, 80801, 526, 18, 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 TestCustomOptionsError1(t *testing.T) { t.Parallel() _, fileAnnotations := testBuild(t, false, filepath.Join("testdata", "customoptionserror1")) require.Equal(t, 1, len(fileAnnotations), fileAnnotations) require.Equal( t, "field a.Baz.bat: option (a.foo).bat: field bat of a.Foo does not exist", fileAnnotations[0].Message(), ) }
explode_data.jsonl/1253
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 130 }
[ 2830, 3393, 10268, 3798, 1454, 16, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 741, 197, 6878, 1034, 21418, 1669, 1273, 11066, 1155, 11, 895, 11, 26054, 22363, 445, 92425, 497, 330, 9163, 2875, 841, 16, 5455, 17957, 12808, 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 TestCreateSelfSignedIstioCAWithSecret(t *testing.T) { rootCertPem := cert1Pem // Use the same signing cert and root cert for self-signed CA. signingCertPem := []byte(cert1Pem) signingKeyPem := []byte(key1Pem) client := fake.NewSimpleClientset() initSecret := k8ssecret.BuildSecret("", CASecret, "default", nil, nil, nil, signingCertPem, signingKeyPem, istioCASecretType) _, err := client.CoreV1().Secrets("default").Create(context.TODO(), initSecret, metav1.CreateOptions{}) if err != nil { t.Errorf("Failed to create secret (error: %s)", err) } caCertTTL := time.Hour defaultCertTTL := 30 * time.Minute maxCertTTL := time.Hour org := "test.ca.Org" caNamespace := "default" const rootCertFile = "" rootCertCheckInverval := time.Hour rsaKeySize := 2048 caopts, err := NewSelfSignedIstioCAOptions(context.Background(), 0, caCertTTL, rootCertCheckInverval, defaultCertTTL, maxCertTTL, org, false, caNamespace, -1, client.CoreV1(), rootCertFile, false, rsaKeySize) if err != nil { t.Fatalf("Failed to create a self-signed CA Options: %v", err) } ca, err := NewIstioCA(caopts) if err != nil { t.Errorf("Got error while creating self-signed CA: %v", err) } if ca == nil { t.Fatalf("Failed to create a self-signed CA.") } signingCert, err := util.ParsePemEncodedCertificate(signingCertPem) if err != nil { t.Errorf("Failed to parse cert (error: %s)", err) } signingCertFromCA, _, certChainBytesFromCA, rootCertBytesFromCA := ca.GetCAKeyCertBundle().GetAll() if !signingCert.Equal(signingCertFromCA) { t.Error("Signing cert does not match") } if !bytes.Equal(rootCertBytesFromCA, []byte(rootCertPem)) { t.Error("Root cert does not match") } if len(certChainBytesFromCA) != 0 { t.Errorf("Cert chain should be empty") } }
explode_data.jsonl/15496
{ "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, 4021, 12092, 49312, 40, 267, 815, 5049, 2354, 19773, 1155, 353, 8840, 836, 8, 341, 33698, 36934, 47, 336, 1669, 2777, 16, 47, 336, 198, 197, 322, 5443, 279, 1852, 15971, 2777, 323, 3704, 2777, 369, 656, 92553, 9183, 624, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestSilenceSetTimeRange(t *testing.T) { now := utcNow() cases := []struct { sil *pb.Silence start, end time.Time err string }{ // Bad arguments. { sil: &pb.Silence{}, start: now, end: now.Add(-time.Minute), err: "end time must not be before start time", }, // Expired silence. { sil: &pb.Silence{ StartsAt: now.Add(-time.Hour), EndsAt: now.Add(-time.Second), }, start: now, end: now, err: "expired silence must not be modified", }, // Pending silences. { sil: &pb.Silence{ StartsAt: now.Add(time.Hour), EndsAt: now.Add(2 * time.Hour), UpdatedAt: now.Add(-time.Hour), }, start: now.Add(-time.Minute), end: now.Add(time.Hour), err: "start time cannot be set into the past", }, { sil: &pb.Silence{ StartsAt: now.Add(time.Hour), EndsAt: now.Add(2 * time.Hour), UpdatedAt: now.Add(-time.Hour), }, start: now.Add(time.Minute), end: now.Add(time.Minute), }, { sil: &pb.Silence{ StartsAt: now.Add(time.Hour), EndsAt: now.Add(2 * time.Hour), UpdatedAt: now.Add(-time.Hour), }, start: now, // set to exactly start now. end: now.Add(2 * time.Hour), }, // Active silences. { sil: &pb.Silence{ StartsAt: now.Add(-time.Hour), EndsAt: now.Add(2 * time.Hour), UpdatedAt: now.Add(-time.Hour), }, start: now.Add(-time.Minute), end: now.Add(2 * time.Hour), err: "start time of active silence cannot be modified", }, { sil: &pb.Silence{ StartsAt: now.Add(-time.Hour), EndsAt: now.Add(2 * time.Hour), UpdatedAt: now.Add(-time.Hour), }, start: now.Add(-time.Hour), end: now.Add(-time.Second), err: "end time cannot be set into the past", }, { sil: &pb.Silence{ StartsAt: now.Add(-time.Hour), EndsAt: now.Add(2 * time.Hour), UpdatedAt: now.Add(-time.Hour), }, start: now.Add(-time.Hour), end: now, }, { sil: &pb.Silence{ StartsAt: now.Add(-time.Hour), EndsAt: now.Add(2 * time.Hour), UpdatedAt: now.Add(-time.Hour), }, start: now.Add(-time.Hour), end: now.Add(3 * time.Hour), }, } for _, c := range cases { origSilence := cloneSilence(c.sil) sil, err := silenceSetTimeRange(c.sil, now, c.start, c.end) if err == nil { if c.err != "" { t.Errorf("expected error containing %q but got none", c.err) } // The original silence must not have been modified. require.Equal(t, origSilence, c.sil, "original silence illegally modified") require.Equal(t, sil.StartsAt, c.start) require.Equal(t, sil.EndsAt, c.end) require.Equal(t, sil.UpdatedAt, now) continue } if err != nil && c.err == "" { t.Errorf("unexpected error %q", err) continue } if !strings.Contains(err.Error(), c.err) { t.Errorf("expected error to contain %q but got %q", c.err, err) } } }
explode_data.jsonl/2692
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1403 }
[ 2830, 3393, 27571, 763, 1649, 1462, 6046, 1155, 353, 8840, 836, 8, 341, 80922, 1669, 69596, 7039, 2822, 1444, 2264, 1669, 3056, 1235, 341, 197, 1903, 321, 286, 353, 16650, 808, 321, 763, 198, 197, 21375, 11, 835, 882, 16299, 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...
7
func TestBoolArrayScanError(t *testing.T) { for _, tt := range []struct { input, err string }{ {``, "unable to parse array"}, {`{`, "unable to parse array"}, {`{{t},{f}}`, "cannot convert ARRAY[2][1] to BoolArray"}, {`{NULL}`, `could not parse boolean array index 0: invalid boolean ""`}, {`{a}`, `could not parse boolean array index 0: invalid boolean "a"`}, {`{t,b}`, `could not parse boolean array index 1: invalid boolean "b"`}, {`{t,f,cd}`, `could not parse boolean array index 2: invalid boolean "cd"`}, } { arr := BoolArray{true, true, true} err := arr.Scan(tt.input) if err == nil { t.Fatalf("Expected error for %q, got none", tt.input) } if !strings.Contains(err.Error(), tt.err) { t.Errorf("Expected error to contain %q for %q, got %q", tt.err, tt.input, err) } if !reflect.DeepEqual(arr, BoolArray{true, true, true}) { t.Errorf("Expected destination not to change for %q, got %+v", tt.input, arr) } } }
explode_data.jsonl/5309
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 388 }
[ 2830, 3393, 11233, 1857, 26570, 1454, 1155, 353, 8840, 836, 8, 341, 2023, 8358, 17853, 1669, 2088, 3056, 1235, 341, 197, 22427, 11, 1848, 914, 198, 197, 59403, 197, 197, 90, 90716, 330, 45928, 311, 4715, 1334, 7115, 197, 197, 90, 63, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 Test_BuildAPKs_withKeystoreConfig(t *testing.T) { // Given tool := givenTool() aabPath := "/path/to/app.aab" apksPath := "/path/to/app.apks" keystoreConfig := givenKeystoreConfig() expectedCommand := buildAPKsCommand(tool, aabPath, apksPath, &keystoreConfig) // When actualCommand := tool.BuildAPKs(aabPath, apksPath, &keystoreConfig).GetCmd().Args // Then require.Equal(t, expectedCommand, actualCommand) }
explode_data.jsonl/58096
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 154 }
[ 2830, 3393, 96686, 2537, 42, 82, 6615, 6608, 63373, 2648, 1155, 353, 8840, 836, 8, 341, 197, 322, 16246, 198, 197, 14172, 1669, 2661, 7740, 741, 11323, 370, 1820, 1669, 3521, 2343, 32429, 10640, 5849, 370, 698, 69898, 2787, 1820, 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 TestRetrieve(t *testing.T) { cc := startServer(t) defer cc.Close() ctx := grpcx.WriteWorkerID(context.Background(), "idA") keys := []string{"foo", "bar", "baz/baz/baz"} st := "whatever" rt, artifacts := populate(ctx, cc, t, keys, 300, st) dst := makeTempDir(t) defer os.RemoveAll(dst) client := jobpb.NewLegacyArtifactRetrievalServiceClient(cc) for _, a := range artifacts { filename := makeFilename(dst, a.Name) if err := Retrieve(ctx, client, a, rt, dst); err != nil { t.Errorf("failed to retrieve %v: %v", a.Name, err) continue } verifySHA256(t, filename, a.Sha256) } }
explode_data.jsonl/55334
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 247 }
[ 2830, 3393, 87665, 1155, 353, 8840, 836, 8, 341, 63517, 1669, 1191, 5475, 1155, 340, 16867, 12527, 10421, 2822, 20985, 1669, 47900, 87, 4073, 21936, 915, 5378, 19047, 1507, 330, 307, 32, 1138, 80112, 1669, 3056, 917, 4913, 7975, 497, 33...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestLimit(t *testing.T) { var posts []*Post qs := dORM.QueryTable("post") num, err := qs.Limit(1).All(&posts) throwFail(t, err) throwFail(t, AssertIs(num, 1)) num, err = qs.Limit(-1).All(&posts) throwFail(t, err) throwFail(t, AssertIs(num, 4)) num, err = qs.Limit(-1, 2).All(&posts) throwFail(t, err) throwFail(t, AssertIs(num, 2)) num, err = qs.Limit(0, 2).All(&posts) throwFail(t, err) throwFail(t, AssertIs(num, 2)) }
explode_data.jsonl/18131
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 201 }
[ 2830, 3393, 16527, 1155, 353, 8840, 836, 8, 341, 2405, 7999, 29838, 4133, 198, 18534, 82, 1669, 294, 4365, 15685, 2556, 445, 2203, 1138, 22431, 11, 1848, 1669, 32421, 1214, 2353, 7, 16, 568, 2403, 2099, 12664, 340, 9581, 19524, 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 TestAssociateGroupWithUser(t *testing.T) { ts := httptest.NewTLSServer( http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { fmt.Fprintln(w, associateGroupWithUserResponse) }), ) defer ts.Close() duo := buildAdminClient(ts.URL, nil) result, err := duo.AssociateGroupWithUser("DU3RP9I2WOC59VZX672N", "DGXXXXXXXXXXXXXXXXXX") if err != nil { t.Errorf("Unexpected error from AssociateGroupWithUser call %v", err.Error()) } if result.Stat != "OK" { t.Errorf("Expected OK, but got %s", result.Stat) } }
explode_data.jsonl/61408
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 210 }
[ 2830, 3393, 95540, 2808, 2354, 1474, 1155, 353, 8840, 836, 8, 341, 57441, 1669, 54320, 70334, 7121, 13470, 1220, 2836, 1006, 197, 28080, 89164, 18552, 3622, 1758, 37508, 11, 435, 353, 1254, 9659, 8, 341, 298, 11009, 991, 33655, 3622, 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 TestTimer(t *testing.T) { timer := StartTimer() time.Sleep(time.Second * 3 / 10) duration1 := int(math.Floor(timer.Lap() * 10)) if 3 != duration1 { t.Errorf("Timer 1st rap failure") } time.Sleep(time.Second * 5 / 10) duration2 := int(math.Floor(timer.Lap() * 10)) if 5 != duration2 { t.Errorf("Timer 2nd rap failure") } }
explode_data.jsonl/48430
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 138 }
[ 2830, 3393, 10105, 1155, 353, 8840, 836, 8, 341, 51534, 1669, 5145, 10105, 741, 21957, 31586, 9730, 32435, 353, 220, 18, 608, 220, 16, 15, 340, 89300, 16, 1669, 526, 37270, 77649, 42892, 1214, 391, 368, 353, 220, 16, 15, 1171, 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...
3
func TestPublicKeyToAddress(t *testing.T) { publicKey := "03a34b99f22c790c4e36b2b3c2c35a36db06226e41c692fc82b8b56ac1c540c5bd" bytes, err := hex.DecodeString(publicKey) if err != nil { t.Fatal(err) return } address, err := AddressFromPublicKey(bytes) if err != nil { t.Fatal(err) return } hash160 := make([]byte, 20) copy(hash160, address.hash160[:]) hash160Hex := hex.EncodeToString(hash160) if hash160Hex != "9a1c78a507689f6f54b847ad1cef1e614ee23f1e" { t.Errorf("hash160Hex is wrong 9a1c78a507689f6f54b847ad1cef1e614ee23f1e -- %s", hash160Hex) return } if address.addressStr != "1F3sAm6ZtwLAUnj7d38pGFxtP3RVEvtsbV" { t.Errorf("address is wrong 1F3sAm6ZtwLAUnj7d38pGFxtP3RVEvtsbV -- %s", address.addressStr) return } }
explode_data.jsonl/60819
{ "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, 61822, 1249, 4286, 1155, 353, 8840, 836, 8, 1476, 1219, 1592, 1669, 330, 15, 18, 64, 18, 19, 65, 24, 24, 69, 17, 17, 66, 22, 24, 15, 66, 19, 68, 18, 21, 65, 17, 65, 18, 66, 17, 66, 18, 20, 64, 18, 21, 1999, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestFindPathFromExtract(t *testing.T) { tempdir := t.TempDir() testImageRef := "docker.io/rancher/rke2-runtime:v1.22.4-rke2r1" ref, err := name.ParseReference(testImageRef) if err != nil { t.Fatalf("Failed to parse image reference: %v", err) } testOperatingSystems := map[string]string{ "linux": "containerd", "windows": "containerd.exe", } // https://github.com/google/go-containerregistry/commit/f9a1886f3df0e2b00d6c62715114fe1093ab1ad7 // changed go-containerregistry behavior; tar paths are now platform-specific and will have forward // slashes on Linux and backslashes on Windows. for operatingSystem, pauseBin := range testOperatingSystems { image, err := remote.Image(ref, remote.WithPlatform(v1.Platform{Architecture: "amd64", OS: operatingSystem})) if err != nil { t.Fatalf("Failed to pull remote image: %v", err) } extractMap := map[string]string{ "/bin": filepath.Join(tempdir, "bin"), "/charts": filepath.Join(tempdir, "charts"), } t.Logf("Testing ExtractDirs with map %#v for %s", extractMap, operatingSystem) if err := ExtractDirs(image, extractMap); err != nil { t.Errorf("Failed to extract containerd binary for %s: %v", operatingSystem, err) continue } i, err := os.Stat(filepath.Join(tempdir, "bin", pauseBin)) if err != nil { t.Errorf("containerd binary for %s not found: %v", operatingSystem, err) continue } t.Logf("containerd binary for %s extracted successfully: %s", operatingSystem, i.Name()) } }
explode_data.jsonl/34356
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 558 }
[ 2830, 3393, 9885, 1820, 3830, 28959, 1155, 353, 8840, 836, 8, 341, 16280, 3741, 1669, 259, 65009, 6184, 741, 18185, 1906, 3945, 1669, 330, 28648, 4245, 7382, 3497, 261, 7382, 440, 17, 68912, 52649, 16, 13, 17, 17, 13, 19, 3795, 440, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestRequestedState(t *testing.T) { req := &requested{} require.Equal(t, "requested", req.Name()) require.False(t, req.CanTransitionTo(&null{})) require.False(t, req.CanTransitionTo(&invited{})) require.False(t, req.CanTransitionTo(req)) require.True(t, req.CanTransitionTo(&responded{})) require.False(t, req.CanTransitionTo(&completed{})) }
explode_data.jsonl/2087
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 137 }
[ 2830, 3393, 37630, 1397, 1155, 353, 8840, 836, 8, 341, 24395, 1669, 609, 67105, 16094, 17957, 12808, 1155, 11, 330, 67105, 497, 4232, 2967, 2398, 17957, 50757, 1155, 11, 4232, 53280, 21768, 1249, 2099, 2921, 6257, 1171, 17957, 50757, 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 TestTestServer(t *testing.T) { client, closer := TestServer(t, nil) defer closer() path := "secret/foo" data := map[string]interface{}{ "value": "bar", } _, err := client.Logical().Write(path, data) if err != nil { t.Fatal(err) } secret, err := client.Logical().Read(path) if err != nil { t.Fatal(err) } val := secret.Data["value"].(string) if val != "bar" { t.Fatalf("expected secret/foo.value to be bar, got %s", val) } }
explode_data.jsonl/3206
{ "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, 2271, 5475, 1155, 353, 8840, 836, 8, 341, 25291, 11, 12128, 1669, 3393, 5475, 1155, 11, 2092, 340, 16867, 12128, 2822, 26781, 1669, 330, 20474, 60555, 698, 8924, 1669, 2415, 14032, 31344, 67066, 197, 197, 63307, 788, 330, 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...
4
func TestLast(t *testing.T) { assert := require.New(t) var input interface{} assert.Nil(Last(nil)) assert.Nil(Last(input)) input = []int{} assert.Nil(Last(input)) input = []int{1, 3, 5} assert.Equal(5, Last(input)) }
explode_data.jsonl/45559
{ "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, 5842, 1155, 353, 8840, 836, 8, 341, 6948, 1669, 1373, 7121, 1155, 340, 2405, 1946, 3749, 31483, 6948, 59678, 4957, 559, 27907, 1171, 6948, 59678, 4957, 559, 5384, 4390, 22427, 284, 3056, 396, 16094, 6948, 59678, 4957, 559, 5...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1