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 TestUnfreeze(t *testing.T) {
c, err := NewContainer(ContainerName)
if err != nil {
t.Errorf(err.Error())
}
if err := c.Unfreeze(); err != nil {
t.Errorf(err.Error())
}
c.Wait(RUNNING, 30*time.Second)
if !c.Running() {
t.Errorf("Unfreezing the container failed...")
}
} | explode_data.jsonl/2768 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 123
} | [
2830,
3393,
1806,
51638,
1155,
353,
8840,
836,
8,
341,
1444,
11,
1848,
1669,
1532,
4502,
75145,
675,
340,
743,
1848,
961,
2092,
341,
197,
3244,
13080,
3964,
6141,
2398,
197,
630,
743,
1848,
1669,
272,
10616,
51638,
2129,
1848,
961,
20... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestAccDataSourceSystemInformation_basic(t *testing.T) {
resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Providers: testAccProviders,
Steps: []resource.TestStep{
{
Config: testAccSystemInformationConfig(),
Check: resource.ComposeTestCheckFunc(
resource.TestCheckResourceAttrSet("data.junos_system_information.test", "hardware_model"),
resource.TestCheckResourceAttrSet("data.junos_system_information.test", "os_name"),
resource.TestCheckResourceAttrSet("data.junos_system_information.test", "os_version"),
resource.TestCheckResourceAttrSet("data.junos_system_information.test", "serial_number"),
resource.TestCheckResourceAttrSet("data.junos_system_information.test", "cluster_node"),
),
},
},
})
} | explode_data.jsonl/50015 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 282
} | [
2830,
3393,
14603,
17173,
2320,
14873,
34729,
1155,
353,
8840,
836,
8,
341,
50346,
8787,
1155,
11,
5101,
31363,
515,
197,
197,
4703,
3973,
25,
220,
2915,
368,
314,
1273,
14603,
4703,
3973,
1155,
8,
1153,
197,
197,
37351,
25,
1273,
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 TestCloudHypervisorAddNetCheckEnpointTypes(t *testing.T) {
assert := assert.New(t)
tapPath := "/path/to/tap"
validVeth := &VethEndpoint{}
validVeth.NetPair.TapInterface.TAPIface.Name = tapPath
type args struct {
e Endpoint
}
// nolint: govet
tests := []struct {
name string
args args
wantErr bool
}{
{"TapEndpoint", args{e: &TapEndpoint{}}, true},
{"Empty VethEndpoint", args{e: &VethEndpoint{}}, true},
{"Valid VethEndpoint", args{e: validVeth}, false},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
clh := &cloudHypervisor{}
if err := clh.addNet(tt.args.e); (err != nil) != tt.wantErr {
t.Errorf("cloudHypervisor.addNet() error = %v, wantErr %v", err, tt.wantErr)
} else if err == nil {
assert.Equal(*(*clh.vmconfig.Net)[0].Tap, tapPath)
}
})
}
} | explode_data.jsonl/68496 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 365
} | [
2830,
3393,
16055,
39,
1082,
31396,
2212,
6954,
3973,
1702,
2768,
4173,
1155,
353,
8840,
836,
8,
341,
6948,
1669,
2060,
7121,
1155,
692,
3244,
391,
1820,
1669,
3521,
2343,
32429,
5523,
391,
1837,
56322,
53,
769,
1669,
609,
53,
769,
27... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
func TestTargetScrapeScrapeCancel(t *testing.T) {
block := make(chan struct{})
server := httptest.NewServer(
http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
<-block
}),
)
defer server.Close()
serverURL, err := url.Parse(server.URL)
if err != nil {
panic(err)
}
ts := &targetScraper{
Target: &Target{
labels: labels.FromStrings(
model.SchemeLabel, serverURL.Scheme,
model.AddressLabel, serverURL.Host,
),
},
client: http.DefaultClient,
}
ctx, cancel := context.WithCancel(context.Background())
errc := make(chan error)
go func() {
time.Sleep(1 * time.Second)
cancel()
}()
go func() {
_, err := ts.scrape(ctx, ioutil.Discard)
if err == nil {
errc <- errors.New("Expected error but got nil")
} else if ctx.Err() != context.Canceled {
errc <- errors.Errorf("Expected context cancellation error but got: %s", ctx.Err())
}
close(errc)
}()
select {
case <-time.After(5 * time.Second):
t.Fatalf("Scrape function did not return unexpectedly")
case err := <-errc:
if err != nil {
t.Fatalf(err.Error())
}
}
// If this is closed in a defer above the function the test server
// doesn't terminate and the test doesn't complete.
close(block)
} | explode_data.jsonl/56137 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 482
} | [
2830,
3393,
6397,
3326,
19842,
3326,
19842,
9269,
1155,
353,
8840,
836,
8,
341,
47996,
1669,
1281,
35190,
2036,
6257,
692,
41057,
1669,
54320,
70334,
7121,
5475,
1006,
197,
28080,
89164,
18552,
3622,
1758,
37508,
11,
435,
353,
1254,
9659,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestInputWrapperSwap(t *testing.T) {
ctx, done := context.WithTimeout(context.Background(), time.Second*30)
defer done()
conf := input.NewConfig()
conf.Type = "generate"
conf.Generate.Interval = "10ms"
conf.Generate.Mapping = `root.name = "from root generate"`
bMgr := bmock.NewManager()
iWrapped, err := bMgr.NewInput(conf)
require.NoError(t, err)
iWrapper := wrapInput(iWrapped)
select {
case tran, open := <-iWrapper.TransactionChan():
require.True(t, open)
assert.Equal(t, `{"name":"from root generate"}`, string(tran.Payload.Get(0).Get()))
assert.NoError(t, tran.Ack(ctx, nil))
case <-ctx.Done():
t.Fatal(ctx.Err())
}
for i := 0; i < 5; i++ {
conf = input.NewConfig()
conf.Type = "generate"
conf.Generate.Interval = "10ms"
conf.Generate.Mapping = fmt.Sprintf(`root.name = "from generate %v"`, i)
go func() {
assert.NoError(t, iWrapper.closeExistingInput(ctx))
iWrapped, err = bMgr.NewInput(conf)
assert.NoError(t, err)
iWrapper.swapInput(iWrapped)
}()
expected := fmt.Sprintf(`{"name":"from generate %v"}`, i)
consumeLoop:
for {
select {
case tran, open := <-iWrapper.TransactionChan():
require.True(t, open, i)
actual := string(tran.Payload.Get(0).Get())
assert.NoError(t, tran.Ack(ctx, nil), i)
if expected == actual {
break consumeLoop
}
case <-ctx.Done():
t.Fatal(ctx.Err(), i)
}
}
}
iWrapper.CloseAsync()
require.NoError(t, iWrapper.WaitForClose(time.Second*5))
} | explode_data.jsonl/51066 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 636
} | [
2830,
3393,
2505,
11542,
46179,
1155,
353,
8840,
836,
8,
341,
20985,
11,
2814,
1669,
2266,
26124,
7636,
5378,
19047,
1507,
882,
32435,
9,
18,
15,
340,
16867,
2814,
2822,
67850,
1669,
1946,
7121,
2648,
741,
67850,
10184,
284,
330,
19366,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestGetUsersByStatus(t *testing.T) {
th := Setup(t)
defer th.TearDown()
team, appErr := th.App.CreateTeam(th.Context, &model.Team{
DisplayName: "dn_" + model.NewId(),
Name: GenerateTestTeamName(),
Email: th.GenerateTestEmail(),
Type: model.TeamOpen,
})
require.Nil(t, appErr, "failed to create team")
channel, appErr := th.App.CreateChannel(th.Context, &model.Channel{
DisplayName: "dn_" + model.NewId(),
Name: "name_" + model.NewId(),
Type: model.ChannelTypeOpen,
TeamId: team.Id,
CreatorId: model.NewId(),
}, false)
require.Nil(t, appErr, "failed to create channel")
createUserWithStatus := func(username string, status string) *model.User {
id := model.NewId()
user, err := th.App.CreateUser(th.Context, &model.User{
Email: "success+" + id + "@simulator.amazonses.com",
Username: "un_" + username + "_" + id,
Nickname: "nn_" + id,
Password: "Password1",
})
require.Nil(t, err, "failed to create user")
th.LinkUserToTeam(user, team)
th.AddUserToChannel(user, channel)
th.App.SaveAndBroadcastStatus(&model.Status{
UserId: user.Id,
Status: status,
Manual: true,
})
return user
}
// Creating these out of order in case that affects results
offlineUser1 := createUserWithStatus("offline1", model.StatusOffline)
offlineUser2 := createUserWithStatus("offline2", model.StatusOffline)
awayUser1 := createUserWithStatus("away1", model.StatusAway)
awayUser2 := createUserWithStatus("away2", model.StatusAway)
onlineUser1 := createUserWithStatus("online1", model.StatusOnline)
onlineUser2 := createUserWithStatus("online2", model.StatusOnline)
dndUser1 := createUserWithStatus("dnd1", model.StatusDnd)
dndUser2 := createUserWithStatus("dnd2", model.StatusDnd)
client := th.CreateClient()
_, _, err := client.Login(onlineUser2.Username, "Password1")
require.NoError(t, err)
t.Run("sorting by status then alphabetical", func(t *testing.T) {
usersByStatus, _, err := client.GetUsersInChannelByStatus(channel.Id, 0, 8, "")
require.NoError(t, err)
expectedUsersByStatus := []*model.User{
onlineUser1,
onlineUser2,
awayUser1,
awayUser2,
dndUser1,
dndUser2,
offlineUser1,
offlineUser2,
}
require.Equal(t, len(expectedUsersByStatus), len(usersByStatus))
for i := range usersByStatus {
require.Equal(t, expectedUsersByStatus[i].Id, usersByStatus[i].Id)
}
})
t.Run("paging", func(t *testing.T) {
usersByStatus, _, err := client.GetUsersInChannelByStatus(channel.Id, 0, 3, "")
require.NoError(t, err)
require.Len(t, usersByStatus, 3)
require.Equal(t, onlineUser1.Id, usersByStatus[0].Id, "online users first")
require.Equal(t, onlineUser2.Id, usersByStatus[1].Id, "online users first")
require.Equal(t, awayUser1.Id, usersByStatus[2].Id, "expected to receive away users second")
usersByStatus, _, err = client.GetUsersInChannelByStatus(channel.Id, 1, 3, "")
require.NoError(t, err)
require.Equal(t, awayUser2.Id, usersByStatus[0].Id, "expected to receive away users second")
require.Equal(t, dndUser1.Id, usersByStatus[1].Id, "expected to receive dnd users third")
require.Equal(t, dndUser2.Id, usersByStatus[2].Id, "expected to receive dnd users third")
usersByStatus, _, err = client.GetUsersInChannelByStatus(channel.Id, 1, 4, "")
require.NoError(t, err)
require.Len(t, usersByStatus, 4)
require.Equal(t, dndUser1.Id, usersByStatus[0].Id, "expected to receive dnd users third")
require.Equal(t, dndUser2.Id, usersByStatus[1].Id, "expected to receive dnd users third")
require.Equal(t, offlineUser1.Id, usersByStatus[2].Id, "expected to receive offline users last")
require.Equal(t, offlineUser2.Id, usersByStatus[3].Id, "expected to receive offline users last")
})
} | explode_data.jsonl/47556 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 1450
} | [
2830,
3393,
1949,
7137,
1359,
2522,
1155,
353,
8840,
836,
8,
341,
70479,
1669,
18626,
1155,
340,
16867,
270,
836,
682,
4454,
2822,
197,
9196,
11,
906,
7747,
1669,
270,
5105,
7251,
14597,
24365,
9328,
11,
609,
2528,
65842,
515,
197,
19... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestK8SServiceFileModeOctalToDecimalAssertions(t *testing.T) {
t.Parallel()
helmChartPath, err := filepath.Abs(filepath.Join("..", "charts", "k8s-service"))
require.NoError(t, err)
testCases := []string{
"800", // First digit greater than max (7)
"080", // Second digit greater than max (7)
"008", // Third digit greater than max (7)
"nan", // Not a number
"75n", // Not a number
"0644", // Not three digits
"44", // Not three digits
}
for _, testCase := range testCases {
// Capture range variable to force scope
testCase := testCase
t.Run(testCase, func(t *testing.T) {
t.Parallel()
// We make sure to pass in the linter_values.yaml values file, which we assume has all the required values
// defined.
options := &helm.Options{
ValuesFiles: []string{filepath.Join("..", "charts", "k8s-service", "linter_values.yaml")},
SetValues: map[string]string{
"secrets.dbsettings.as": "volume",
"secrets.dbsettings.mountPath": "/etc/db",
"secrets.dbsettings.items.host.filePath": "host.txt",
"secrets.dbsettings.items.host.fileMode": testCase,
},
}
// Render just the deployment resource
_, err := helm.RenderTemplateE(t, options, helmChartPath, strings.ToLower(t.Name()), []string{"templates/deployment.yaml"})
assert.Error(t, err)
})
}
} | explode_data.jsonl/59764 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 546
} | [
2830,
3393,
42,
23,
1220,
1017,
1703,
3636,
18053,
278,
1249,
11269,
90206,
1155,
353,
8840,
836,
8,
341,
3244,
41288,
7957,
741,
9598,
23162,
14488,
1820,
11,
1848,
1669,
26054,
33255,
34793,
22363,
95032,
497,
330,
36584,
497,
330,
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,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestUint(t *testing.T) {
var args struct {
Foo uint
Ptr *uint
}
err := parse("--foo 7 --ptr 8", &args)
require.NoError(t, err)
assert.EqualValues(t, 7, args.Foo)
assert.EqualValues(t, 8, *args.Ptr)
} | explode_data.jsonl/12986 | {
"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,
21570,
1155,
353,
8840,
836,
8,
341,
2405,
2827,
2036,
341,
197,
12727,
2624,
2622,
198,
197,
197,
5348,
353,
2496,
198,
197,
532,
9859,
1669,
4715,
21549,
7975,
220,
22,
1177,
3505,
220,
23,
497,
609,
2116,
340,
17957,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestPrefetch(t *testing.T) {
seed := time.Now().UnixNano()
r := mrand.New(mrand.NewSource(seed))
for _, tc := range []struct {
name string
size int64
bufferSize int
readOffset int64
expRead int
}{
{
name: "one byte",
size: 1,
bufferSize: 1,
readOffset: 0,
expRead: 1,
},
{
name: "one byte",
size: 1,
bufferSize: 10,
readOffset: 0,
expRead: 1,
},
{
name: "ten bytes",
size: 10,
bufferSize: 5,
readOffset: 0,
expRead: 5,
},
{
name: "thousand bytes",
size: 1000,
bufferSize: 100,
readOffset: 0,
expRead: 100,
},
{
name: "thousand bytes",
size: 1000,
bufferSize: 100,
readOffset: 900,
expRead: 100,
},
{
name: "thousand bytes",
size: 1000,
bufferSize: 100,
readOffset: 800,
expRead: 100,
},
{
name: "one chunk",
size: 4096,
bufferSize: 4096,
readOffset: 0,
expRead: 4096,
},
{
name: "one chunk minus a few",
size: 4096,
bufferSize: 4093,
readOffset: 0,
expRead: 4093,
},
{
name: "one chunk minus a few",
size: 4096,
bufferSize: 4093,
readOffset: 3,
expRead: 4093,
},
{
name: "one byte at the end",
size: 4096,
bufferSize: 1,
readOffset: 4095,
expRead: 1,
},
{
name: "one byte at the end",
size: 8192,
bufferSize: 1,
readOffset: 8191,
expRead: 1,
},
{
name: "one byte at the end",
size: 8192,
bufferSize: 1,
readOffset: 8190,
expRead: 1,
},
{
name: "one byte at the end",
size: 100000,
bufferSize: 1,
readOffset: 99999,
expRead: 1,
},
{
name: "10kb",
size: 10000,
bufferSize: 5,
readOffset: 5,
expRead: 5,
},
{
name: "10kb",
size: 10000,
bufferSize: 1500,
readOffset: 5,
expRead: 1500,
},
{
name: "100kb",
size: 100000,
bufferSize: 8000,
readOffset: 100,
expRead: 8000,
},
{
name: "100kb",
size: 100000,
bufferSize: 80000,
readOffset: 100,
expRead: 80000,
},
{
name: "10megs",
size: 10000000,
bufferSize: 8000,
readOffset: 990000,
expRead: 8000,
},
{
name: "10megs",
size: 10000000,
bufferSize: 80000,
readOffset: 900000,
expRead: 80000,
},
{
name: "10megs",
size: 10000000,
bufferSize: 8000000,
readOffset: 900000,
expRead: 8000000,
},
{
name: "10megs",
size: 1000000,
bufferSize: 2000000,
readOffset: 900000,
expRead: 100000,
},
} {
t.Run(tc.name, func(t *testing.T) {
ctx := context.Background()
store := mock.NewStorer()
defer store.Close()
data, err := ioutil.ReadAll(io.LimitReader(r, tc.size))
if err != nil {
t.Fatal(err)
}
s := splitter.NewSimpleSplitter(store, storage.ModePutUpload)
addr, err := s.Split(ctx, ioutil.NopCloser(bytes.NewReader(data)), tc.size, false)
if err != nil {
t.Fatal(err)
}
j, _, err := joiner.New(ctx, store, addr)
if err != nil {
t.Fatal(err)
}
b := make([]byte, tc.bufferSize)
n, err := j.ReadAt(b, tc.readOffset)
if err != nil {
t.Fatal(err)
}
if n != tc.expRead {
t.Errorf("read %d bytes out of %d", n, tc.expRead)
}
ro := int(tc.readOffset)
if !bytes.Equal(b[:n], data[ro:ro+n]) {
t.Error("buffer does not match generated data")
}
})
}
} | explode_data.jsonl/51988 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 1994
} | [
2830,
3393,
29978,
2995,
1155,
353,
8840,
836,
8,
341,
197,
22602,
1669,
882,
13244,
1005,
55832,
83819,
2822,
7000,
1669,
296,
11335,
7121,
1255,
11335,
7121,
3608,
44163,
4390,
2023,
8358,
17130,
1669,
2088,
3056,
1235,
341,
197,
11609,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 7 |
func TestReconcile_TryToDeleteLVGWithVolume(t *testing.T) {
var (
c = setup(t, node1ID, lvgCR1)
req = ctrl.Request{NamespacedName: types.NamespacedName{Namespace: ns, Name: lvgCR1.Name}}
)
lvgToDell := lvgCR1
lvgToDell.ObjectMeta.DeletionTimestamp = &v1.Time{Time: time.Now()}
lvgToDell.ObjectMeta.Finalizers = []string{lvgFinalizer}
err := c.k8sClient.UpdateCR(tCtx, &lvgToDell)
assert.Nil(t, err)
err = c.k8sClient.CreateCR(tCtx, testVolumeCR1.Name, &testVolumeCR1)
assert.Nil(t, err)
res, err := c.Reconcile(req)
assert.Nil(t, err)
assert.Equal(t, res, ctrl.Result{})
lvg := &lvgcrd.LogicalVolumeGroup{}
err = c.k8sClient.ReadCR(tCtx, lvgToDell.Name, "", lvg)
assert.Nil(t, err)
assert.NotNil(t, lvg)
assert.Equal(t, lvgToDell.Name, lvg.Name)
} | explode_data.jsonl/51720 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 363
} | [
2830,
3393,
693,
40446,
457,
1139,
884,
64105,
40258,
38,
2354,
18902,
1155,
353,
8840,
836,
8,
341,
2405,
2399,
197,
1444,
256,
284,
6505,
1155,
11,
2436,
16,
915,
11,
326,
7239,
8973,
16,
340,
197,
24395,
284,
23743,
9659,
90,
798... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestInsecureMustBeBool(t *testing.T) {
paramUri := fmt.Sprintf("localhost?user=test&pass=yep&insecure=foo")
_, err := newHawkularSource(paramUri)
if err == nil {
t.Errorf("Expected error from newHawkularSource")
}
} | explode_data.jsonl/55849 | {
"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,
641,
25132,
31776,
3430,
11233,
1155,
353,
8840,
836,
8,
341,
36037,
13899,
1669,
8879,
17305,
445,
8301,
30,
872,
53538,
5,
6385,
29368,
747,
5,
258,
25132,
28,
7975,
1138,
197,
6878,
1848,
1669,
501,
39,
23397,
1276,
360... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestMasterIndex(t *testing.T) {
bhInIdx1 := restic.NewRandomBlobHandle()
bhInIdx2 := restic.NewRandomBlobHandle()
bhInIdx12 := restic.BlobHandle{ID: restic.NewRandomID(), Type: restic.TreeBlob}
blob1 := restic.PackedBlob{
PackID: restic.NewRandomID(),
Blob: restic.Blob{
BlobHandle: bhInIdx1,
Length: uint(restic.CiphertextLength(10)),
Offset: 0,
},
}
blob2 := restic.PackedBlob{
PackID: restic.NewRandomID(),
Blob: restic.Blob{
BlobHandle: bhInIdx2,
Length: uint(restic.CiphertextLength(100)),
Offset: 10,
UncompressedLength: 200,
},
}
blob12a := restic.PackedBlob{
PackID: restic.NewRandomID(),
Blob: restic.Blob{
BlobHandle: bhInIdx12,
Length: uint(restic.CiphertextLength(123)),
Offset: 110,
},
}
blob12b := restic.PackedBlob{
PackID: restic.NewRandomID(),
Blob: restic.Blob{
BlobHandle: bhInIdx12,
Length: uint(restic.CiphertextLength(123)),
Offset: 50,
UncompressedLength: 80,
},
}
idx1 := repository.NewIndex()
idx1.Store(blob1)
idx1.Store(blob12a)
idx2 := repository.NewIndex()
idx2.Store(blob2)
idx2.Store(blob12b)
mIdx := repository.NewMasterIndex()
mIdx.Insert(idx1)
mIdx.Insert(idx2)
// test idInIdx1
found := mIdx.Has(bhInIdx1)
rtest.Equals(t, true, found)
blobs := mIdx.Lookup(bhInIdx1)
rtest.Equals(t, []restic.PackedBlob{blob1}, blobs)
size, found := mIdx.LookupSize(bhInIdx1)
rtest.Equals(t, true, found)
rtest.Equals(t, uint(10), size)
// test idInIdx2
found = mIdx.Has(bhInIdx2)
rtest.Equals(t, true, found)
blobs = mIdx.Lookup(bhInIdx2)
rtest.Equals(t, []restic.PackedBlob{blob2}, blobs)
size, found = mIdx.LookupSize(bhInIdx2)
rtest.Equals(t, true, found)
rtest.Equals(t, uint(200), size)
// test idInIdx12
found = mIdx.Has(bhInIdx12)
rtest.Equals(t, true, found)
blobs = mIdx.Lookup(bhInIdx12)
rtest.Equals(t, 2, len(blobs))
// test Lookup result for blob12a
found = false
if blobs[0] == blob12a || blobs[1] == blob12a {
found = true
}
rtest.Assert(t, found, "blob12a not found in result")
// test Lookup result for blob12b
found = false
if blobs[0] == blob12b || blobs[1] == blob12b {
found = true
}
rtest.Assert(t, found, "blob12a not found in result")
size, found = mIdx.LookupSize(bhInIdx12)
rtest.Equals(t, true, found)
rtest.Equals(t, uint(123), size)
// test not in index
found = mIdx.Has(restic.BlobHandle{ID: restic.NewRandomID(), Type: restic.TreeBlob})
rtest.Assert(t, !found, "Expected no blobs when fetching with a random id")
blobs = mIdx.Lookup(restic.NewRandomBlobHandle())
rtest.Assert(t, blobs == nil, "Expected no blobs when fetching with a random id")
_, found = mIdx.LookupSize(restic.NewRandomBlobHandle())
rtest.Assert(t, !found, "Expected no blobs when fetching with a random id")
// Test Count
num := mIdx.Count(restic.DataBlob)
rtest.Equals(t, uint(2), num)
num = mIdx.Count(restic.TreeBlob)
rtest.Equals(t, uint(2), num)
} | explode_data.jsonl/57821 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 1411
} | [
2830,
3393,
18041,
1552,
1155,
353,
8840,
836,
8,
341,
2233,
71,
641,
11420,
16,
1669,
2732,
292,
7121,
13999,
37985,
6999,
741,
2233,
71,
641,
11420,
17,
1669,
2732,
292,
7121,
13999,
37985,
6999,
741,
2233,
71,
641,
11420,
16,
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... | 5 |
func TestCheckPointMultiple(t *testing.T) {
setup()
assert := require.New(t)
r := strings.NewReader(`
2021-01-14T12:16:54.579+0800 INFO CheckPoint {"host": "172.16.5.140", "port": "22", "user": "tidb", "cmd": "test cmd", "sudo": false, "stdout": "success", "stderr": ""}
2021-01-14T12:17:32.222+0800 DEBUG Environment variables {"env": ["TIUP_HOME=/home/tidb/.tiup"}
2021-01-14T12:17:33.579+0800 INFO Execute command {"command": "tiup cluster deploy test v4.0.9 /Users/joshua/test.yaml"}
2021-01-14T12:16:54.579+0800 INFO CheckPoint {"host": "172.16.5.141", "port": "22", "user": "tidb", "src": "src", "dst": "dst", "download": false}
`)
c, err := NewCheckPoint(r)
assert.Nil(err)
ctx := NewContext(context.Background())
p := c.Acquire(ctx, map[string]interface{}{
"host": "172.16.5.140",
"port": 22,
"user": "tidb",
"sudo": false,
"cmd": "test cmd",
})
assert.NotNil(p.Hit())
assert.Equal(p.Hit()["stdout"], "success")
p.Release(nil)
p = c.Acquire(ctx, map[string]interface{}{
"host": "172.16.5.141",
"port": 22,
"user": "tidb",
"src": "src",
"dst": "dst",
"download": false,
})
assert.NotNil(p.Hit())
p.Release(nil)
} | explode_data.jsonl/27336 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 582
} | [
2830,
3393,
3973,
2609,
32089,
1155,
353,
8840,
836,
8,
341,
84571,
2822,
6948,
1669,
1373,
7121,
1155,
340,
7000,
1669,
9069,
68587,
61528,
197,
197,
17,
15,
17,
16,
12,
15,
16,
12,
16,
19,
51,
16,
17,
25,
16,
21,
25,
20,
19,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestSpanBuilderCanSplitSpan(t *testing.T) {
defer leaktest.AfterTest(t)()
ctx := context.TODO()
params, _ := tests.CreateTestServerParams()
s, sqlDB, kvDB := serverutils.StartServer(t, params)
defer s.Stopper().Stop(ctx)
execCfg := s.ExecutorConfig().(ExecutorConfig)
tcs := []struct {
sql string
index string
prefixLen int
numNeededFamilies int
containsNull bool
canSplit bool
}{
{
sql: "a INT, b INT, c INT, d INT, PRIMARY KEY (a, b), FAMILY (a, b, c), FAMILY (d)",
index: "primary",
prefixLen: 2,
numNeededFamilies: 1,
canSplit: true,
},
{
sql: "a INT, b INT, c INT, d INT, PRIMARY KEY (a, b), FAMILY (a, b, c), FAMILY (d)",
index: "primary",
prefixLen: 1,
numNeededFamilies: 1,
canSplit: false,
},
{
sql: "a INT, b INT, c INT, d INT, PRIMARY KEY (a, b), FAMILY (a, b, c, d)",
index: "primary",
prefixLen: 2,
numNeededFamilies: 1,
canSplit: false,
},
{
sql: "a INT, b INT, c INT, INDEX i (b) STORING (a, c), FAMILY (a), FAMILY (b), FAMILY (c)",
index: "i",
prefixLen: 1,
numNeededFamilies: 1,
canSplit: false,
},
{
sql: "a INT, b INT, c INT, UNIQUE INDEX i (b) STORING (a, c), FAMILY (a), FAMILY (b), FAMILY (c)",
index: "i",
prefixLen: 1,
numNeededFamilies: 1,
containsNull: true,
canSplit: false,
},
{
sql: "a INT, b INT, c INT, UNIQUE INDEX i (b) STORING (a, c), FAMILY (a), FAMILY (b), FAMILY (c)",
index: "i",
prefixLen: 1,
numNeededFamilies: 1,
containsNull: false,
canSplit: true,
},
}
if _, err := sqlDB.Exec("CREATE DATABASE t"); err != nil {
t.Fatal(err)
}
for _, tc := range tcs {
t.Run(tc.sql, func(t *testing.T) {
if _, err := sqlDB.Exec("DROP TABLE IF EXISTS t.t"); err != nil {
t.Fatal(err)
}
sql := fmt.Sprintf("CREATE TABLE t.t (%s)", tc.sql)
if _, err := sqlDB.Exec(sql); err != nil {
t.Fatal(err)
}
desc := sqlbase.GetTableDescriptor(kvDB, "t", "t")
idx, _, err := desc.FindIndexByName(tc.index)
if err != nil {
t.Fatal(err)
}
builder := span.MakeBuilder(execCfg.Codec, desc, idx)
if res := builder.CanSplitSpanIntoSeparateFamilies(
tc.numNeededFamilies, tc.prefixLen, tc.containsNull); res != tc.canSplit {
t.Errorf("expected result to be %v, but found %v", tc.canSplit, res)
}
})
}
} | explode_data.jsonl/46902 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 1411
} | [
2830,
3393,
12485,
3297,
6713,
20193,
12485,
1155,
353,
8840,
836,
8,
341,
16867,
23352,
1944,
36892,
2271,
1155,
8,
741,
20985,
1669,
2266,
90988,
741,
25856,
11,
716,
1669,
7032,
7251,
2271,
5475,
4870,
741,
1903,
11,
5704,
3506,
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 TestTransformNestedMessages(t *testing.T) {
schema := []byte(`
syntax = "proto3";
package api.myapp;
message Outer { // Level 0
int32 field_int32 = 1;
message MiddleAA { // Level 1
string field_string = 1;
message Inner { // Level 2
int64 ival = 1;
bool booly = 2;
}
}
message MiddleBB { // Level 1
int64 field_int64 = 1;
message Inner { // Level 2
int32 ival = 1;
bool booly = 2;
}
}
}
`)
input := new(bytes.Buffer)
input.Write(schema)
output := new(bytes.Buffer)
transformer := proto2gql.NewTransformer(output)
if err := transformer.Transform(input); err != nil {
t.Fatal(err)
}
expected := `
type ApiMyappOuter {
field_int32: Int
}
type ApiMyappOuterMiddleAA {
field_string: String
}
type ApiMyappOuterMiddleAAInner {
ival: Int
booly: Boolean
}
type ApiMyappOuterMiddleBB {
field_int64: Int
}
type ApiMyappOuterMiddleBBInner {
ival: Int
booly: Boolean
}
`
expected = strings.TrimSpace(expected)
actual := strings.TrimSpace(output.String())
if expected != actual {
t.Fatalf("Expected %s to equal to %s", expected, actual)
}
} | explode_data.jsonl/2065 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 538
} | [
2830,
3393,
8963,
71986,
15820,
1155,
353,
8840,
836,
8,
341,
1903,
3416,
1669,
3056,
3782,
61528,
197,
1903,
13662,
284,
330,
15110,
18,
876,
197,
197,
1722,
6330,
12618,
676,
401,
197,
24753,
55197,
314,
1698,
442,
9395,
220,
15,
19... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
func TestKeyRevocation(t *testing.T) {
kring, _ := ReadKeyRing(readerFromHex(revokedKeyHex))
// revokedKeyHex contains these keys:
// pub 1024R/9A34F7C0 2014-03-25 [revoked: 2014-03-25]
// sub 1024R/1BA3CD60 2014-03-25 [revoked: 2014-03-25]
ids := []uint64{0xA401D9F09A34F7C0, 0x5CD3BE0A1BA3CD60}
for _, id := range ids {
keys := kring.KeysById(id)
if len(keys) != 1 {
t.Errorf("Expected KeysById to find revoked key %X, but got %d matches", id, len(keys))
}
keys = kring.KeysByIdUsage(id, 0)
if len(keys) != 0 {
t.Errorf("Expected KeysByIdUsage to filter out revoked key %X, but got %d matches", id, len(keys))
}
}
} | explode_data.jsonl/14738 | {
"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,
1592,
36184,
2276,
1155,
353,
8840,
836,
8,
341,
197,
9855,
287,
11,
716,
1669,
4457,
1592,
43466,
21987,
3830,
20335,
5801,
85,
10823,
1592,
20335,
4390,
197,
322,
64346,
1592,
20335,
5610,
1493,
6894,
510,
197,
322,
6675,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestBaseIndent(t *testing.T) {
t.Parallel()
// The testfile must not contain multi-line raw strings since those
// are not indented (because their values must not change) and make
// this test fail.
const filename = "printer.go"
src, err := ioutil.ReadFile(filename)
if err != nil {
panic(err) // error in test
}
file, err := parser.ParseFile(fset, filename, src, 0)
if err != nil {
panic(err) // error in test
}
for indent := 0; indent < 4; indent++ {
indent := indent
t.Run(fmt.Sprint(indent), func(t *testing.T) {
t.Parallel()
var buf bytes.Buffer
(&Config{Tabwidth: tabwidth, Indent: indent}).Fprint(&buf, fset, file)
// all code must be indented by at least 'indent' tabs
lines := bytes.Split(buf.Bytes(), []byte{'\n'})
for i, line := range lines {
if len(line) == 0 {
continue // empty lines don't have indentation
}
n := 0
for j, b := range line {
if b != '\t' {
// end of indentation
n = j
break
}
}
if n < indent {
t.Errorf("line %d: got only %d tabs; want at least %d: %q", i, n, indent, line)
}
}
})
}
} | explode_data.jsonl/64603 | {
"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,
3978,
42729,
1155,
353,
8840,
836,
8,
341,
3244,
41288,
7957,
741,
197,
322,
576,
1273,
1192,
1969,
537,
6644,
7299,
8447,
7112,
9069,
2474,
1846,
198,
197,
322,
525,
537,
1257,
15864,
320,
27653,
862,
2750,
1969,
537,
229... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestSubscribeStreamFlowControlOverflow(t *testing.T) {
subscription := subscriptionPartition{"projects/123456/locations/us-central1-b/subscriptions/my-sub", 0}
msg1 := seqMsgWithOffsetAndSize(56, 900)
msg2 := seqMsgWithOffsetAndSize(57, 101) // Overflows ReceiveSettings.MaxOutstandingBytes = 1000
verifiers := test.NewVerifiers(t)
stream := test.NewRPCVerifier(t)
stream.Push(initSubReqCommit(subscription), initSubResp(), nil)
stream.Push(initFlowControlReq(), msgSubResp(msg1), nil)
stream.Push(nil, msgSubResp(msg2), nil)
verifiers.AddSubscribeStream(subscription.Path, subscription.Partition, stream)
mockServer.OnTestStart(verifiers)
defer mockServer.OnTestEnd()
sub := newTestSubscribeStream(t, subscription, testSubscriberSettings())
sub.Receiver.ValidateMsg(msg1)
if gotErr, wantErr := sub.FinalError(), errTokenCounterBytesNegative; !test.ErrorEqual(gotErr, wantErr) {
t.Errorf("Final err: (%v), want: (%v)", gotErr, wantErr)
}
} | explode_data.jsonl/31644 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 331
} | [
2830,
3393,
28573,
3027,
18878,
3273,
42124,
1155,
353,
8840,
836,
8,
341,
28624,
12124,
1669,
15142,
49978,
4913,
17161,
14,
16,
17,
18,
19,
20,
21,
14,
31309,
62431,
84081,
16,
1455,
37885,
29966,
34198,
17967,
497,
220,
15,
532,
21... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestNodeAddressesByProviderID(t *testing.T) {
ctrl := gomock.NewController(t)
defer ctrl.Finish()
cloud := GetTestCloud(ctrl)
cloud.Config.UseInstanceMetadata = true
metadataTemplate := `{"compute":{"name":"%s"},"network":{"interface":[{"ipv4":{"ipAddress":[{"privateIpAddress":"%s","publicIpAddress":"%s"}]},"ipv6":{"ipAddress":[{"privateIpAddress":"%s","publicIpAddress":"%s"}]}}]}}`
testcases := []struct {
name string
nodeName string
ipV4 string
ipV6 string
ipV4Public string
ipV6Public string
providerID string
expectedAddress []v1.NodeAddress
expectedErrMsg error
}{
{
name: "NodeAddressesByProviderID should get both ipV4 and ipV6 private addresses",
nodeName: "vm1",
providerID: "azure:///subscriptions/subscription/resourceGroups/rg/providers/Microsoft.Compute/virtualMachines/vm1",
ipV4: "10.240.0.1",
ipV6: "1111:11111:00:00:1111:1111:000:111",
expectedAddress: []v1.NodeAddress{
{
Type: v1.NodeHostName,
Address: "vm1",
},
{
Type: v1.NodeInternalIP,
Address: "10.240.0.1",
},
{
Type: v1.NodeInternalIP,
Address: "1111:11111:00:00:1111:1111:000:111",
},
},
},
{
name: "NodeAddressesByProviderID should report error when IPs are empty",
nodeName: "vm1",
providerID: "azure:///subscriptions/subscription/resourceGroups/rg/providers/Microsoft.Compute/virtualMachines/vm1",
expectedErrMsg: fmt.Errorf("get empty IP addresses from instance metadata service"),
},
{
name: "NodeAddressesByProviderID should return nil if node is unmanaged",
providerID: "/subscriptions/subscription/resourceGroups/rg/providers/Microsoft.Compute/virtualMachines/vm1",
},
{
name: "NodeAddressesByProviderID should report error if providerID is invalid",
providerID: "azure:///subscriptions/subscription/resourceGroups/rg/providers/Microsoft.Compute/virtualMachine/vm3",
expectedErrMsg: fmt.Errorf("error splitting providerID"),
},
{
name: "NodeAddressesByProviderID should report error if providerID is null",
expectedErrMsg: fmt.Errorf("providerID is empty, the node is not initialized yet"),
},
}
for _, test := range testcases {
listener, err := net.Listen("tcp", "127.0.0.1:0")
if err != nil {
t.Errorf("Test [%s] unexpected error: %v", test.name, err)
}
mux := http.NewServeMux()
mux.Handle("/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
fmt.Fprintf(w, metadataTemplate, test.nodeName, test.ipV4, test.ipV4Public, test.ipV6, test.ipV6Public)
}))
go func() {
_ = http.Serve(listener, mux)
}()
defer listener.Close()
cloud.Metadata, err = NewInstanceMetadataService("http://" + listener.Addr().String() + "/")
if err != nil {
t.Errorf("Test [%s] unexpected error: %v", test.name, err)
}
ipAddresses, err := cloud.NodeAddressesByProviderID(context.Background(), test.providerID)
assert.Equal(t, test.expectedErrMsg, err, test.name)
assert.Equal(t, test.expectedAddress, ipAddresses, test.name)
}
} | explode_data.jsonl/60299 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 1306
} | [
2830,
3393,
1955,
52290,
1359,
5179,
915,
1155,
353,
8840,
836,
8,
341,
84381,
1669,
342,
316,
1176,
7121,
2051,
1155,
340,
16867,
23743,
991,
18176,
741,
197,
12361,
1669,
2126,
2271,
16055,
62100,
340,
197,
12361,
10753,
9046,
2523,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestAssociateAuditor(t *testing.T) {
Convey("Associate auditor", t, func() {
setup(MockRoute{"PUT", "/v2/organizations/bc7b4caf-f4b8-4d85-b126-0729b9351e56/auditors/user-guid", []string{associateOrgUserPayload}, "", 201, "", nil}, t)
defer teardown()
c := &Config{
ApiAddress: server.URL,
Token: "foobar",
}
client, err := NewClient(c)
So(err, ShouldBeNil)
org := &Org{
Guid: "bc7b4caf-f4b8-4d85-b126-0729b9351e56",
c: client,
}
newOrg, err := org.AssociateAuditor("user-guid")
So(err, ShouldBeNil)
So(newOrg.Guid, ShouldEqual, "bc7b4caf-f4b8-4d85-b126-0729b9351e56")
})
} | explode_data.jsonl/4440 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 311
} | [
2830,
3393,
95540,
52949,
1919,
1155,
353,
8840,
836,
8,
341,
93070,
5617,
445,
95540,
53306,
497,
259,
11,
2915,
368,
341,
197,
84571,
66436,
4899,
4913,
6221,
497,
3521,
85,
17,
14,
69253,
3470,
66,
22,
65,
19,
68796,
2220,
19,
65... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestGitService_GetBlobRaw(t *testing.T) {
client, mux, _, teardown := setup()
defer teardown()
mux.HandleFunc("/repos/o/r/git/blobs/s", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "GET")
testHeader(t, r, "Accept", "application/vnd.github.v3.raw")
fmt.Fprint(w, `raw contents here`)
})
blob, _, err := client.Git.GetBlobRaw(context.Background(), "o", "r", "s")
if err != nil {
t.Errorf("Git.GetBlobRaw returned error: %v", err)
}
want := []byte("raw contents here")
if !bytes.Equal(blob, want) {
t.Errorf("GetBlobRaw returned %q, want %q", blob, want)
}
} | explode_data.jsonl/11496 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 259
} | [
2830,
3393,
46562,
1860,
13614,
37985,
20015,
1155,
353,
8840,
836,
8,
341,
25291,
11,
59807,
11,
8358,
49304,
1669,
6505,
741,
16867,
49304,
2822,
2109,
2200,
63623,
4283,
68354,
20271,
7382,
60590,
3470,
68164,
2687,
497,
2915,
3622,
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 Test_DrawingObjects_GetDocumentDrawingObjectByIndexWithoutNodePath(t *testing.T) {
config := ReadConfiguration(t)
client, ctx := PrepareTest(t, config)
remoteDataFolder := remoteBaseTestDataFolder + "/DocumentElements/DrawingObjectss"
localFile := "Common/test_multi_pages.docx"
remoteFileName := "TestGetDocumentDrawingObjectByIndexWithoutNodePath.docx"
UploadNextFileToStorage(t, ctx, client, GetLocalFile(localFile), remoteDataFolder + "/" + remoteFileName)
options := map[string]interface{}{
"folder": remoteDataFolder,
}
actual, _, err := client.WordsApi.GetDocumentDrawingObjectByIndex(ctx, remoteFileName, int32(0), options)
if err != nil {
t.Error(err)
}
assert.NotNil(t, actual.DrawingObject, "Validate GetDocumentDrawingObjectByIndexWithoutNodePath response.");
assert.Equal(t, 300.0, *actual.DrawingObject.Height, "Validate GetDocumentDrawingObjectByIndexWithoutNodePath response.");
} | explode_data.jsonl/60048 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 330
} | [
2830,
3393,
1557,
1696,
11543,
13614,
7524,
37437,
1190,
1359,
1552,
26040,
1955,
1820,
1155,
353,
8840,
836,
8,
341,
262,
2193,
1669,
4457,
7688,
1155,
340,
262,
2943,
11,
5635,
1669,
31166,
2271,
1155,
11,
2193,
340,
262,
8699,
1043,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestBSTIterator(t *testing.T) {
root := &TreeNode{
Val: 5,
}
root.Left = &TreeNode{
Val: 2,
}
root.Left.Left = &TreeNode{
Val: 1,
}
root.Right = &TreeNode{
Val: 8,
}
root.Right.Left = &TreeNode{
Val: 6,
}
root.Right.Left.Right = &TreeNode{
Val: 7,
}
root.Right.Right = &TreeNode{
Val: 9,
}
temp := 0
// 1 2 5 6 7 8 9
iterator := Constructor(root)
iterator.Next() // 1
temp = iterator.Next() // 2
if temp != 2 {
t.Fail()
}
iterator.HasNext() // return true
iterator.Next() // return 5
iterator.HasNext() // return true
temp = iterator.Next() // return 6
if temp != 6 {
t.Fail()
}
iterator.HasNext() // return true
iterator.Next() // return 7
iterator.Next()
iterator.Next()
if !iterator.HasNext() {
t.Fail()
}
} | explode_data.jsonl/17524 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 355
} | [
2830,
3393,
61006,
11951,
1155,
353,
8840,
836,
8,
341,
33698,
1669,
609,
26597,
515,
197,
197,
2208,
25,
220,
20,
345,
197,
532,
33698,
17978,
284,
609,
26597,
515,
197,
197,
2208,
25,
220,
17,
345,
197,
532,
33698,
17978,
17978,
2... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 4 |
func TestOrderedMapOutputRegressions1102(t *testing.T) {
t.Parallel()
generateTestCase := filepath.Join(TEST_FIXTURE_GET_OUTPUT, "regression-1102")
cleanupTerraformFolder(t, generateTestCase)
cleanupTerragruntFolder(t, generateTestCase)
stdout := bytes.Buffer{}
stderr := bytes.Buffer{}
command := fmt.Sprintf("terragrunt apply --terragrunt-non-interactive --terragrunt-working-dir %s", generateTestCase)
path := filepath.Join(generateTestCase, "backend.tf")
// runs terragrunt for the first time and checks the output "backend.tf" file.
require.NoError(
t,
runTerragruntCommand(t, command, &stdout, &stderr),
)
expected, _ := ioutil.ReadFile(path)
require.Contains(t, string(expected), "local")
// runs terragrunt again. All the outputs must be
// equal to the first run.
for i := 0; i < 20; i++ {
require.NoError(
t,
runTerragruntCommand(t, command, &stdout, &stderr),
)
actual, _ := ioutil.ReadFile(path)
require.Equal(t, expected, actual)
}
} | explode_data.jsonl/10141 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 381
} | [
2830,
3393,
54384,
2227,
5097,
693,
2483,
908,
16,
16,
15,
17,
1155,
353,
8840,
836,
8,
341,
3244,
41288,
7957,
741,
3174,
13220,
16458,
1669,
26054,
22363,
50320,
42635,
41486,
12702,
23981,
11,
330,
1580,
11185,
12,
16,
16,
15,
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 TestRouter(t *testing.T) {
router := New()
routed := false
router.Handle("GET", "/user/:name", func(ctx *fasthttp.RequestCtx) {
routed = true
want := map[string]string{"name": "gopher"}
if ctx.UserValue("name") != want["name"] {
t.Fatalf("wrong wildcard values: want %v, got %v", want["name"], ctx.UserValue("name"))
}
ctx.Success("foo/bar", []byte("success"))
})
s := &fasthttp.Server{
Handler: router.Handler,
}
rw := &readWriter{}
rw.r.WriteString("GET /user/gopher?baz HTTP/1.1\r\n\r\n")
ch := make(chan error)
go func() {
ch <- s.ServeConn(rw)
}()
select {
case err := <-ch:
if err != nil {
t.Fatalf("return error %s", err)
}
case <-time.After(100 * time.Millisecond):
t.Fatalf("timeout")
}
if !routed {
t.Fatal("routing failed")
}
} | explode_data.jsonl/42485 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 343
} | [
2830,
3393,
9523,
1155,
353,
8840,
836,
8,
341,
67009,
1669,
1532,
2822,
7000,
18533,
1669,
895,
198,
67009,
31421,
445,
3806,
497,
3521,
872,
11315,
606,
497,
2915,
7502,
353,
9349,
1254,
9659,
23684,
8,
341,
197,
7000,
18533,
284,
8... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestList(t *testing.T) {
th.SetupHTTP()
defer th.TeardownHTTP()
fixtures.HandleListSuccessfully(t)
serverId := "4d8c3732-a248-40ed-bebc-539a6ffd25c0"
count := 0
err := List(client.ServiceClient(), serverId).EachPage(func(page pagination.Page) (bool, error) {
count++
actual, err := volumeattach.ExtractVolumeAttachments(page)
th.AssertNoErr(t, err)
th.CheckDeepEquals(t, ExpectedVolumeAttachmentSlice, actual)
return true, nil
})
th.AssertNoErr(t, err)
th.CheckEquals(t, 1, count)
} | explode_data.jsonl/34613 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 209
} | [
2830,
3393,
852,
1155,
353,
8840,
836,
8,
341,
70479,
39820,
9230,
741,
16867,
270,
94849,
37496,
9230,
741,
1166,
941,
18513,
31421,
852,
35959,
1155,
340,
41057,
764,
1669,
330,
19,
67,
23,
66,
18,
22,
18,
17,
7409,
17,
19,
23,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestSearch__fedwireSearchStateOnlyRequest(t *testing.T) {
u, _ := url.Parse("https://moov.io/fed/wire/search?state=IA")
req := readFEDSearchRequest(u)
if req.State != "IA" {
t.Errorf("req.State=%s", req.State)
}
if !req.stateOnly() {
t.Errorf("req is not state only")
}
} | explode_data.jsonl/71099 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 120
} | [
2830,
3393,
5890,
563,
51123,
35531,
5890,
1397,
7308,
1900,
1155,
353,
8840,
836,
8,
341,
10676,
11,
716,
1669,
2515,
8937,
445,
2428,
1110,
6355,
859,
4245,
6663,
291,
6324,
554,
23167,
30,
2454,
28,
5863,
1138,
24395,
1669,
1349,
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 TestStepInParked(t *testing.T) {
if runtime.GOOS == "freebsd" {
t.SkipNow()
}
runTest(t, "parallel_next", func(client *daptest.Client, fixture protest.Fixture) {
runDebugSessionWithBPs(t, client, "launch",
// Launch
func() {
client.LaunchRequest("exec", fixture.Path, !stopOnEntry)
},
// Set breakpoints
fixture.Source, []int{15},
[]onBreakpoint{{ // Stop at line 15
execute: func() {
goroutineId := testStepParkedHelper(t, client, fixture)
client.StepInRequest(goroutineId)
client.ExpectStepInResponse(t)
se := client.ExpectStoppedEvent(t)
if se.Body.ThreadId != goroutineId {
t.Fatalf("StepIn did not continue on the selected goroutine, expected %d got %d", goroutineId, se.Body.ThreadId)
}
},
disconnect: false,
}})
})
} | explode_data.jsonl/17339 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 336
} | [
2830,
3393,
8304,
641,
47,
42061,
1155,
353,
8840,
836,
8,
341,
743,
15592,
97574,
3126,
621,
330,
10593,
51835,
1,
341,
197,
3244,
57776,
7039,
741,
197,
532,
56742,
2271,
1155,
11,
330,
46103,
11257,
497,
2915,
12805,
353,
91294,
19... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestGuildMarshal(t *testing.T) {
data, err := ioutil.ReadFile("testdata/guild/guild1.json")
check(err, t)
v := Guild{}
err = httd.Unmarshal(data, &v)
check(err, t)
} | explode_data.jsonl/55140 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 81
} | [
2830,
3393,
72574,
55438,
1155,
353,
8840,
836,
8,
341,
8924,
11,
1848,
1669,
43144,
78976,
445,
92425,
4846,
1498,
4846,
1498,
16,
4323,
1138,
25157,
3964,
11,
259,
692,
5195,
1669,
32492,
16094,
9859,
284,
34323,
1296,
38097,
2592,
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 |
func TestReadme(t *testing.T) {
// Create a new cache. (1) expiration is how long complcache
// keeps a value until it is evicted. (2) fill controls
// how long GetOrCreate waits for a new value to be available
// before failing with a time out. (3) gc is the time between
// garbage collection which cleans up expired values from
// the cache
expiration := 1 * time.Minute
fill := 1 * time.Minute
gc := 1 * time.Minute
cache, err := New(expiration, fill, gc)
if err != nil {
panic(err) // New returns errors on bad arguments
}
// While you can just Get a value for a given key, it's best
// to use GetOrCreate. If a cached value is available, that
// value is returned. If no valid value is in the cache, creator
// gets called to first create a value for the cache.
creator := func() (interface{}, error) {
// HTTP may be slow, so we cache it with complcache!
resp, err := http.Get("http://example.com/")
// Creator returns either some value (interface{}) or
// an error. So we can just forward the error.
if err != nil {
return nil, err
}
// We got a value, return that instead.
defer resp.Body.Close()
return ioutil.ReadAll(resp.Body)
}
entry, err := cache.GetOrCreate("example.com", creator)
doSomethingWith(entry, err)
} | explode_data.jsonl/51367 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 403
} | [
2830,
3393,
4418,
2660,
1155,
353,
8840,
836,
8,
341,
197,
322,
4230,
264,
501,
6500,
13,
320,
16,
8,
31692,
374,
1246,
1293,
4581,
9360,
198,
197,
322,
13598,
264,
897,
3080,
432,
374,
3637,
12770,
13,
320,
17,
8,
5155,
11574,
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 TestJSONLines(t *testing.T) {
jsonStr := `
true
false
{"name":"tom"}
[1,2,3,4,5]
{"name":"janet"}
null
12930.1203
`
paths := []string{"..#", "..0", "..2.name", "..#.name", "..6", "..7"}
ress := []string{"7", "true", "tom", `["tom","janet"]`, "12930.1203", ""}
for i, path := range paths {
res := Get(jsonStr, path)
if res.String() != ress[i] {
t.Fatalf("expected '%v', got '%v'", ress[i], res.String())
}
}
jsonStr = `
{"name": "Gilbert", "wins": [["straight", "7♣"], ["one pair", "10♥"]]}
{"name": "Alexa", "wins": [["two pair", "4♠"], ["two pair", "9♠"]]}
{"name": "May", "wins": []}
{"name": "Deloise", "wins": [["three of a kind", "5♣"]]}
`
var i int
lines := strings.Split(strings.TrimSpace(jsonStr), "\n")
ForEachLine(jsonStr, func(line Result) bool {
if line.Raw != lines[i] {
t.Fatalf("expected '%v', got '%v'", lines[i], line.Raw)
}
i++
return true
})
if i != 4 {
t.Fatalf("expected '%v', got '%v'", 4, i)
}
} | explode_data.jsonl/43453 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 442
} | [
2830,
3393,
5370,
16794,
1155,
353,
8840,
836,
8,
341,
30847,
2580,
1669,
22074,
1866,
198,
3849,
198,
4913,
606,
3252,
37401,
16707,
58,
16,
11,
17,
11,
18,
11,
19,
11,
20,
921,
4913,
606,
3252,
22838,
295,
16707,
2921,
198,
16,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
func TestMultiChownWithRecur(t *testing.T) {
fileName := []string{
recursiveDirRoot + "/chown1.txt",
recursiveDirRoot + "/chown2.txt",
recursiveDirRoot + "/chown3.txt",
}
err := Touch(fileName)
if err != nil {
panic(err)
}
t.Cleanup(func() {
_ = RemoveWithRecur(dirRoot)
})
if !Exists(fileName) {
t.Error("Multi ChownWithRecur test failed!")
}
err = ChownWithRecur(dirRoot, 501, 20)
if err != nil {
panic(err)
}
} | explode_data.jsonl/34181 | {
"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,
20358,
1143,
779,
2354,
693,
2352,
1155,
353,
8840,
836,
8,
341,
17661,
675,
1669,
3056,
917,
515,
197,
197,
49512,
6184,
8439,
488,
3521,
331,
779,
16,
3909,
756,
197,
197,
49512,
6184,
8439,
488,
3521,
331,
779,
17,
39... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestScFinishedEv(t *testing.T) {
tests := []testFields{
{
name: "no blocks",
steps: []pcFsmMakeStateValues{
{
currentState: ¶ms{height: 100, items: []pcBlock{}, blocksSynced: 100}, event: scFinishedEv{},
wantState: ¶ms{height: 100, items: []pcBlock{}, blocksSynced: 100},
wantNextEvent: pcFinished{tmState: tmState.State{LastBlockHeight: 100}, blocksSynced: 100},
},
},
},
{
name: "maxHeight+1 block present",
steps: []pcFsmMakeStateValues{
{
currentState: ¶ms{height: 100, items: []pcBlock{
{"P1", 101}}, blocksSynced: 100}, event: scFinishedEv{},
wantState: ¶ms{height: 100, items: []pcBlock{{"P1", 101}}, blocksSynced: 100},
wantNextEvent: pcFinished{tmState: tmState.State{LastBlockHeight: 100}, blocksSynced: 100},
},
},
},
{
name: "more blocks present",
steps: []pcFsmMakeStateValues{
{
currentState: ¶ms{height: 100, items: []pcBlock{
{"P1", 101}, {"P1", 102}}, blocksSynced: 100}, event: scFinishedEv{},
wantState: ¶ms{height: 100, items: []pcBlock{
{"P1", 101}, {"P1", 102}}, blocksSynced: 100, draining: true},
wantNextEvent: noOp,
wantErr: nil,
},
},
},
}
executeProcessorTests(t, tests)
} | explode_data.jsonl/30584 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 560
} | [
2830,
3393,
3326,
24890,
34112,
1155,
353,
8840,
836,
8,
341,
78216,
1669,
3056,
1944,
8941,
515,
197,
197,
515,
298,
11609,
25,
330,
2152,
10010,
756,
298,
18388,
7124,
25,
3056,
3992,
37,
3563,
8078,
1397,
6227,
515,
571,
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 TestResolveConstIntWithIdentWithBadCon(t *testing.T) {
obj := ast.Object{Kind: ast.Con}
expr := ast.Ident{Obj: &obj}
_, err := resolveConstInt(&expr)
if err == nil {
t.Error("should have received error because expr.Obj.Decl == nil")
}
obj.Decl = 0
_, err = resolveConstInt(&expr)
if err == nil {
t.Error("should have received error because expr.Obj.Decl is not *ast.DefineSpec")
}
} | explode_data.jsonl/33718 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 145
} | [
2830,
3393,
56808,
19167,
1072,
2354,
28301,
2354,
17082,
1109,
1155,
353,
8840,
836,
8,
341,
22671,
1669,
11763,
8348,
90,
10629,
25,
11763,
4801,
532,
8122,
649,
1669,
11763,
6444,
306,
90,
5261,
25,
609,
2295,
532,
197,
6878,
1848,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
func TestServer_OperationGroups(t *testing.T) {
log.SetOutput(ioutil.Discard)
defer func() {
log.SetOutput(os.Stdout)
_ = os.RemoveAll(filepath.Join(".", "restapi"))
_ = os.RemoveAll(filepath.Join(".", "search"))
_ = os.RemoveAll(filepath.Join(".", "tasks"))
}()
gen, err := testAppGenerator(t, "../fixtures/codegen/simplesearch.yml", "search")
if assert.NoError(t, err) {
gen.GenOpts.Tags = []string{"search", "tasks"}
gen.GenOpts.IncludeModel = false
gen.GenOpts.IncludeHandler = true
gen.GenOpts.Sections.OperationGroups = []TemplateOpts{
{
Name: "opGroupTest",
Source: "asset:opGroupTest",
Target: "{{ joinFilePath .Target .Name }}",
FileName: "{{ (snakize (pascalize .Name)) }}_opgroup_test.gol",
},
}
err := gen.Generate()
// This attempts fails: template not declared
assert.Error(t, err)
// Tolerates case variations on error message
assert.Contains(t, strings.ToLower(err.Error()), "template doesn't exist")
var opGroupTpl = `
// OperationGroupName={{.Name}}
// RootPackage={{.RootPackage}}
{{ range .Operations }}
// OperationName={{.Name}}
{{end}}`
_ = templates.AddFile("opGroupTest", opGroupTpl)
err = gen.Generate()
assert.NoError(t, err)
//buf := bytes.NewBuffer(nil)
genContent, erf := ioutil.ReadFile("./search/search_opgroup_test.gol")
assert.NoError(t, erf, "Generator should have written a file")
assert.Contains(t, string(genContent), "// OperationGroupName=search")
assert.Contains(t, string(genContent), "// RootPackage=operations")
assert.Contains(t, string(genContent), "// OperationName=search")
genContent, erf = ioutil.ReadFile("./tasks/tasks_opgroup_test.gol")
assert.NoError(t, erf, "Generator should have written a file")
assert.Contains(t, string(genContent), "// OperationGroupName=tasks")
assert.Contains(t, string(genContent), "// RootPackage=operations")
assert.Contains(t, string(genContent), "// OperationName=createTask")
assert.Contains(t, string(genContent), "// OperationName=deleteTask")
assert.Contains(t, string(genContent), "// OperationName=getTasks")
assert.Contains(t, string(genContent), "// OperationName=updateTask")
}
} | explode_data.jsonl/3789 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 820
} | [
2830,
3393,
5475,
2232,
91774,
22173,
1155,
353,
8840,
836,
8,
341,
6725,
4202,
5097,
1956,
30158,
909,
47560,
340,
16867,
2915,
368,
341,
197,
6725,
4202,
5097,
9638,
83225,
340,
197,
197,
62,
284,
2643,
84427,
34793,
22363,
64217,
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 TestSetter(t *testing.T) {
allcoin.Set("ShitCoin", "SHIT COIN")
if !allcoin.Exist("ShitCoin") {
t.Fatal("ShitCoin was added in previous step, but it cannot find it")
}
} | explode_data.jsonl/74136 | {
"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,
44294,
1155,
353,
8840,
836,
8,
341,
50960,
7160,
4202,
445,
2016,
275,
41180,
497,
330,
8590,
952,
7284,
687,
5130,
743,
753,
541,
7160,
5121,
380,
445,
2016,
275,
41180,
899,
341,
197,
3244,
26133,
445,
2016,
275,
41180,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestNewWResourceithOptions(t *testing.T) {
a := memattrs.New()
k, v := "foo", "bar"
MustSet(context.Background(), a, k, v, t)
uid := memuid.NewFromString(resUID)
r, err := NewResource(resType, resName, resGroup, resVersion, resKind, resNsd, WithUID(uid), WithDOTID(testDOTID), WithAttrs(a))
if err != nil {
t.Fatalf("failed creating new resource: %v", err)
}
val, err := r.Attrs().Get(context.Background(), k)
if err != nil {
t.Fatalf("failed to get value for key %s: %v", k, err)
}
if val != v {
t.Errorf("expected attrs val: %s, for key: %s, got: %s", v, k, val)
}
if u := r.UID().String(); u != resUID {
t.Errorf("expected resource uid: %s, got: %s", resUID, u)
}
if d := r.DOTID(); d != testDOTID {
t.Errorf("expected dotid: %s, got: %s", testDOTID, d)
}
} | explode_data.jsonl/38889 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 336
} | [
2830,
3393,
3564,
54,
4783,
410,
3798,
1155,
353,
8840,
836,
8,
341,
11323,
1669,
1833,
20468,
7121,
741,
16463,
11,
348,
1669,
330,
7975,
497,
330,
2257,
698,
9209,
590,
1649,
5378,
19047,
1507,
264,
11,
595,
11,
348,
11,
259,
692,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestInitializeShouldCreateRoot(t *testing.T) {
extraMountPoints := []*MountPoint{}
extraDirectories := []string{}
dir := filepath.Join(tmpDir, "TestInitializeShouldCreateRoot")
chroot := NewChroot(dir, isExistingDir)
err := chroot.Initialize(emptyPath, extraDirectories, extraMountPoints)
assert.NoError(t, err)
defer chroot.Close(defaultLeaveOnDisk)
// when Docker based pipeline:
// - chroot name are static and pre-defined
// - chroot folders are re-cycled
_, err = os.Stat(chroot.RootDir())
if buildpipeline.IsRegularBuild() {
assert.True(t, !os.IsNotExist(err))
} else {
assert.True(t, !os.IsNotExist(err))
}
} | explode_data.jsonl/38790 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 229
} | [
2830,
3393,
9928,
14996,
4021,
8439,
1155,
353,
8840,
836,
8,
341,
8122,
2172,
16284,
11411,
1669,
29838,
16284,
2609,
16094,
8122,
2172,
56397,
1669,
3056,
917,
31483,
48532,
1669,
26054,
22363,
10368,
6184,
11,
330,
2271,
9928,
14996,
4... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
func TestCharptrToString(t *testing.T) {
ctx := log.Testing(t)
ctx = database.Put(ctx, database.NewInMemory(ctx))
s := api.NewStateWithEmptyAllocator(device.Little32)
cb := CommandBuilder{Thread: 0, Arena: s.Arena}
expected := "ħęľĺő ŵōřŀď"
err := api.MutateCmds(ctx, s, nil, nil,
cb.CmdCharptrToString(p(0x1234)).
AddRead(memory.Store(ctx, s.MemoryLayout, p(0x1234), expected)),
)
assert.For(ctx, "err").ThatError(err).Succeeded()
assert.For(ctx, "Data").That(GetState(s).Str()).Equals(expected)
} | explode_data.jsonl/61061 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 220
} | [
2830,
3393,
4768,
3505,
5870,
1155,
353,
8840,
836,
8,
341,
20985,
1669,
1487,
8787,
287,
1155,
340,
20985,
284,
4625,
39825,
7502,
11,
4625,
7121,
641,
10642,
7502,
1171,
1903,
1669,
6330,
7121,
1397,
2354,
3522,
42730,
17848,
1214,
23... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestGetBroadcastCommand_OfflineFlag(t *testing.T) {
clientCtx := client.Context{}.WithOffline(true)
clientCtx = clientCtx.WithTxConfig(simapp.MakeTestEncodingConfig().TxConfig)
cmd := authcli.GetBroadcastCommand()
_ = testutil.ApplyMockIODiscardOutErr(cmd)
cmd.SetArgs([]string{fmt.Sprintf("--%s=true", flags.FlagOffline), ""})
require.EqualError(t, cmd.Execute(), "cannot broadcast tx during offline mode")
} | explode_data.jsonl/82091 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 146
} | [
2830,
3393,
1949,
43362,
4062,
94377,
1056,
12135,
1155,
353,
8840,
836,
8,
341,
25291,
23684,
1669,
2943,
9328,
46391,
2354,
52563,
3715,
340,
25291,
23684,
284,
2943,
23684,
26124,
31584,
2648,
47760,
676,
50133,
2271,
14690,
2648,
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 TestLoadingConfigurationFailure(t *testing.T) {
os.Clearenv()
mustSetEnv(t, "INSIGHTS_RESULTS_SMART_PROXY_CONFIG_FILE", "non existing file")
err := conf.LoadConfiguration("")
assert.Contains(t, err.Error(), `fatal error config file: Config File "non existing file" Not Found in`)
} | explode_data.jsonl/61898 | {
"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,
8578,
7688,
17507,
1155,
353,
8840,
836,
8,
341,
25078,
727,
273,
9151,
85,
2822,
2109,
590,
1649,
14359,
1155,
11,
330,
9557,
4631,
50,
76015,
28845,
2992,
59065,
12568,
8087,
497,
330,
6280,
6350,
1034,
5130,
9859,
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 TestCouchDBResultsIterator_Value_Internal(t *testing.T) {
t.Run("Fail to get value from rows", func(t *testing.T) {
iterator := &couchDBResultsIterator{
resultRows: &mockRows{},
}
value, err := iterator.Value()
require.EqualError(t, err, `failure while scanning result rows: mockRows ScanDoc always fails`)
require.Nil(t, value)
})
} | explode_data.jsonl/72591 | {
"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,
34,
3026,
3506,
9801,
11951,
27867,
37238,
1155,
353,
8840,
836,
8,
341,
3244,
16708,
445,
19524,
311,
633,
897,
504,
6978,
497,
2915,
1155,
353,
8840,
836,
8,
341,
197,
197,
6854,
1669,
609,
66,
3026,
3506,
9801,
11951,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestMarshalUnmarshalTaskASMResource(t *testing.T) {
expectedCredentialsParameter := "secret-id"
expectedRegion := "us-west-2"
expectedExecutionCredentialsID := "credsid"
task := &Task{
Arn: "test",
ResourcesMapUnsafe: make(map[string][]taskresource.TaskResource),
Containers: []*apicontainer.Container{
{
Name: "myName",
Image: "image:tag",
RegistryAuthentication: &apicontainer.RegistryAuthenticationData{
Type: "asm",
ASMAuthData: &apicontainer.ASMAuthData{
CredentialsParameter: expectedCredentialsParameter,
Region: expectedRegion,
},
},
},
},
}
ctrl := gomock.NewController(t)
defer ctrl.Finish()
asmClientCreator := mock_factory.NewMockClientCreator(ctrl)
credentialsManager := mock_credentials.NewMockManager(ctrl)
// create asm auth resource
res := asmauth.NewASMAuthResource(
task.Arn,
task.getAllASMAuthDataRequirements(),
expectedExecutionCredentialsID,
credentialsManager,
asmClientCreator)
res.SetKnownStatus(resourcestatus.ResourceRemoved)
// add asm auth resource to task
task.AddResource(asmauth.ResourceName, res)
// validate asm auth resource
resource, ok := task.getASMAuthResource()
assert.True(t, ok)
asmResource := resource[0].(*asmauth.ASMAuthResource)
req := asmResource.GetRequiredASMResources()
assert.Equal(t, resourcestatus.ResourceRemoved, asmResource.GetKnownStatus())
assert.Equal(t, expectedExecutionCredentialsID, asmResource.GetExecutionCredentialsID())
assert.Equal(t, expectedCredentialsParameter, req[0].CredentialsParameter)
assert.Equal(t, expectedRegion, req[0].Region)
// marshal and unmarshal task
marshal, err := json.Marshal(task)
assert.NoError(t, err)
var otask Task
err = json.Unmarshal(marshal, &otask)
assert.NoError(t, err)
// validate asm auth resource
oresource, ok := otask.getASMAuthResource()
assert.True(t, ok)
oasmResource := oresource[0].(*asmauth.ASMAuthResource)
oreq := oasmResource.GetRequiredASMResources()
assert.Equal(t, resourcestatus.ResourceRemoved, oasmResource.GetKnownStatus())
assert.Equal(t, expectedExecutionCredentialsID, oasmResource.GetExecutionCredentialsID())
assert.Equal(t, expectedCredentialsParameter, oreq[0].CredentialsParameter)
assert.Equal(t, expectedRegion, oreq[0].Region)
} | explode_data.jsonl/37232 | {
"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,
55438,
1806,
27121,
6262,
52584,
4783,
1155,
353,
8840,
836,
8,
1476,
42400,
27025,
4971,
1669,
330,
20474,
12897,
698,
42400,
14091,
1669,
330,
355,
37602,
12,
17,
698,
42400,
20294,
27025,
915,
1669,
330,
85734,
307,
1837,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestEntry_SelectSnapLeft(t *testing.T) {
e, window := setupSelection(t, false)
defer teardownImageTest(window)
c := window.Canvas()
assert.Equal(t, 1, e.CursorRow)
assert.Equal(t, 5, e.CursorColumn)
typeKeys(e, keyShiftLeftUp, fyne.KeyLeft)
assert.Equal(t, 1, e.CursorRow)
assert.Equal(t, 2, e.CursorColumn)
test.AssertRendersToMarkup(t, "entry/selection_snap_left.xml", c)
assert.Equal(t, "", e.SelectedText())
} | explode_data.jsonl/12359 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 182
} | [
2830,
3393,
5874,
58073,
61871,
5415,
1155,
353,
8840,
836,
8,
341,
7727,
11,
3241,
1669,
6505,
11177,
1155,
11,
895,
340,
16867,
49304,
1906,
2271,
15906,
340,
1444,
1669,
3241,
54121,
2822,
6948,
12808,
1155,
11,
220,
16,
11,
384,
2... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestCapabilities(t *testing.T) {
const uid = 343
const gid = 2401
for _, conf := range configs(all) {
t.Logf("Running test with conf: %+v", conf)
spec := testutil.NewSpecWithArgs("sleep", "100")
// We generate files in the host temporary directory.
spec.Mounts = append(spec.Mounts, specs.Mount{
Destination: os.TempDir(),
Source: os.TempDir(),
Type: "bind",
})
rootDir, bundleDir, err := testutil.SetupContainer(spec, conf)
if err != nil {
t.Fatalf("error setting up container: %v", err)
}
defer os.RemoveAll(rootDir)
defer os.RemoveAll(bundleDir)
// Create and start the container.
s, err := container.Create(testutil.UniqueContainerID(), spec, conf, bundleDir, "", "")
if err != nil {
t.Fatalf("error creating container: %v", err)
}
defer s.Destroy()
if err := s.Start(conf); err != nil {
t.Fatalf("error starting container: %v", err)
}
// expectedPL lists the expected process state of the container.
expectedPL := []*control.Process{
{
UID: 0,
PID: 1,
PPID: 0,
C: 0,
Cmd: "sleep",
},
{
UID: uid,
PID: 2,
PPID: 0,
C: 0,
Cmd: "exe",
},
}
if err := waitForProcessList(s, expectedPL[:1]); err != nil {
t.Fatalf("Failed to wait for sleep to start, err: %v", err)
}
// Create an executable that can't be run with the specified UID:GID.
// This shouldn't be callable within the container until we add the
// CAP_DAC_OVERRIDE capability to skip the access check.
exePath := filepath.Join(rootDir, "exe")
if err := ioutil.WriteFile(exePath, []byte("#!/bin/sh\necho hello"), 0770); err != nil {
t.Fatalf("couldn't create executable: %v", err)
}
defer os.Remove(exePath)
// Need to traverse the intermediate directory.
os.Chmod(rootDir, 0755)
execArgs := control.ExecArgs{
Filename: exePath,
Argv: []string{exePath},
Envv: []string{"PATH=" + os.Getenv("PATH")},
WorkingDirectory: "/",
KUID: uid,
KGID: gid,
Capabilities: &auth.TaskCapabilities{},
}
// "exe" should fail because we don't have the necessary permissions.
if _, err := s.Execute(&execArgs); err == nil {
t.Fatalf("container executed without error, but an error was expected")
}
// Now we run with the capability enabled and should succeed.
execArgs.Capabilities = &auth.TaskCapabilities{
EffectiveCaps: auth.CapabilitySetOf(linux.CAP_DAC_OVERRIDE),
}
// "exe" should not fail this time.
if _, err := s.Execute(&execArgs); err != nil {
t.Fatalf("container failed to exec %v: %v", execArgs, err)
}
}
} | explode_data.jsonl/48923 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 1088
} | [
2830,
3393,
55315,
1155,
353,
8840,
836,
8,
341,
4777,
14617,
284,
220,
18,
19,
18,
198,
4777,
45863,
284,
220,
17,
19,
15,
16,
271,
2023,
8358,
2335,
1669,
2088,
42309,
20388,
8,
341,
197,
3244,
98954,
445,
18990,
1273,
448,
2335,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestCapability_ProfileToCapability(t *testing.T) {
assert := assert.New(t)
caps := []Capability{Capability_Unused, Capability_ProfileH264Baseline, Capability_ProfileH264Main, Capability_ProfileH264High, Capability_ProfileH264ConstrainedHigh}
// iterate through lpms-defined profiles to ensure all are accounted for
// need to put into a slice and sort to ensure consistent ordering
profs := []int{}
for k, _ := range ffmpeg.ProfileParameters {
profs = append(profs, int(k))
}
sort.Ints(profs)
for i := range profs {
c, err := profileToCapability(ffmpeg.Profile(profs[i]))
assert.Nil(err)
assert.Equal(caps[i], c)
}
// check invalid profile handling
c, err := profileToCapability(-1)
assert.Equal(Capability_Invalid, c)
assert.Equal(capProfileConv, err)
} | explode_data.jsonl/74084 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 270
} | [
2830,
3393,
63746,
77294,
1249,
63746,
1155,
353,
8840,
836,
8,
341,
6948,
1669,
2060,
7121,
1155,
340,
1444,
2625,
1669,
3056,
63746,
90,
63746,
40687,
2591,
11,
98551,
77294,
39,
17,
21,
19,
64611,
11,
98551,
77294,
39,
17,
21,
19,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
func TestAnnotationMatcher(t *testing.T) {
variations := []string{
"// swagger",
" swagger",
"swagger",
" * swagger",
}
known := []string{
"meta",
"route",
"model",
"parameters",
"strfmt",
"response",
"enum",
"default",
}
for _, variation := range variations {
for _, tpe := range known {
assert.True(t, rxSwaggerAnnotation.MatchString(variation+":"+tpe))
}
}
} | explode_data.jsonl/65952 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 175
} | [
2830,
3393,
19711,
37554,
1155,
353,
8840,
836,
8,
341,
2405,
17144,
1669,
3056,
917,
515,
197,
197,
1,
322,
60823,
756,
197,
197,
1,
60823,
756,
197,
197,
1,
74755,
756,
197,
197,
1,
353,
60823,
756,
197,
532,
197,
5278,
1669,
30... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestStoreBalance(t *testing.T) {
amount1 := decimal.New(232, 0)
amount2 := decimal.New(232, 0)
bal := []model.BalanceForAddress{
{
Address: "bchtest:qpncl685d5eys3tj4vykrhw4507fcuas9scm4qd70e",
PropertyID: 1,
BalanceAvailable: &amount1,
//PendingPos: 9900,
//PendingNeg: -68,
},
{
Address: "bchtest:qpncl685d5eys3tj4vykrhw450734uas9scm4qd7od",
PropertyID: 1,
BalanceAvailable: &amount2,
//PendingPos: 9900,
//PendingNeg: -68,
},
}
err := storeBalanceForAddress(map[string][]model.BalanceForAddress{
bal[0].Address: {bal[0]},
bal[1].Address: {bal[1]},
})
if err != nil {
t.Error(err)
}
} | explode_data.jsonl/57801 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 366
} | [
2830,
3393,
6093,
21190,
1155,
353,
8840,
836,
8,
341,
197,
6045,
16,
1669,
12122,
7121,
7,
17,
18,
17,
11,
220,
15,
340,
197,
6045,
17,
1669,
12122,
7121,
7,
17,
18,
17,
11,
220,
15,
340,
2233,
278,
1669,
3056,
2528,
1785,
4978... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestGiteaCreateFile(t *testing.T) {
client := giteaClient{}
ctx := context.Context{}
author := config.CommitAuthor{}
repo := Repo{}
content := []byte{}
path := ""
message := ""
file := client.CreateFile(&ctx, author, repo, content, path, message)
assert.Nil(t, file)
} | explode_data.jsonl/23620 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 106
} | [
2830,
3393,
38,
632,
64,
4021,
1703,
1155,
353,
8840,
836,
8,
341,
25291,
1669,
342,
632,
64,
2959,
16094,
20985,
1669,
2266,
9328,
16094,
197,
3094,
1669,
2193,
53036,
7133,
16094,
17200,
5368,
1669,
71509,
16094,
27751,
1669,
3056,
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... | 1 |
func TestBeatEventV0(t *testing.T) {
for _, tc := range eventV0Tests {
t.Run(tc.name, func(t *testing.T) {
reg := monitoring.NewRegistry()
p, err := NewFromConfig(Config{Tag: tc.name, Source: header + tc.source + footer}, reg)
if err != nil {
t.Fatal(err)
}
evt, err := p.Run(testEvent())
if tc.assert != nil {
tc.assert(t, evt, err)
} else {
assert.NoError(t, err)
assert.NotNil(t, evt)
}
// Validate that the processor's metrics exist.
var found bool
prefix := fmt.Sprintf("processor.javascript.%s.histogram.process_time", tc.name)
reg.Do(monitoring.Full, func(name string, v interface{}) {
if !found && strings.HasPrefix(name, prefix) {
found = true
}
})
assert.True(t, found, "metrics were not found in registry")
})
}
} | explode_data.jsonl/73408 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 348
} | [
2830,
3393,
43658,
1556,
53,
15,
1155,
353,
8840,
836,
8,
341,
2023,
8358,
17130,
1669,
2088,
1538,
53,
15,
18200,
341,
197,
3244,
16708,
44415,
2644,
11,
2915,
1155,
353,
8840,
836,
8,
341,
298,
37013,
1669,
16558,
7121,
15603,
2822,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestDeleteIntervalById(t *testing.T) {
tests := []struct {
name string
request *http.Request
dbMock interfaces.DBClient
scMock interfaces.SchedulerQueueClient
expectedStatus int
}{
{
name: "OK",
request: createDeleteRequest(ID, TestId),
dbMock: createMockIntervalDeleterForId(nil),
scMock: createMockSCDeleterForId(createIntervals(1)[0], nil),
expectedStatus: http.StatusOK,
},
{
name: "Interval not found",
request: createDeleteRequest(ID, TestId),
dbMock: createMockIntervalDeleterForId(db.ErrNotFound),
scMock: createMockSCDeleterForId(createIntervals(1)[0], nil),
expectedStatus: http.StatusNotFound,
},
{
name: "Error QueryUnescape",
request: createDeleteRequest(ID, TestIncorrectId),
dbMock: createMockIntervalDeleterForId(nil),
scMock: createMockSCDeleterForId(createIntervals(1)[0], nil),
expectedStatus: http.StatusBadRequest,
},
{
name: "Unknown Error",
request: createDeleteRequest(ID, TestId),
dbMock: createMockIntervalDeleterForId(goErrors.New("test error")),
scMock: createMockSCDeleterForId(createIntervals(1)[0], nil),
expectedStatus: http.StatusInternalServerError,
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
rr := httptest.NewRecorder()
restDeleteIntervalByID(rr, tt.request, logger.NewMockClient(), tt.dbMock, tt.scMock)
response := rr.Result()
if response.StatusCode != tt.expectedStatus {
t.Errorf("status code mismatch -- expected %v got %v", tt.expectedStatus, response.StatusCode)
return
}
})
}
} | explode_data.jsonl/51573 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 796
} | [
2830,
3393,
6435,
10256,
2720,
1155,
353,
8840,
836,
8,
341,
78216,
1669,
3056,
1235,
341,
197,
11609,
1843,
914,
198,
197,
23555,
286,
353,
1254,
9659,
198,
197,
20939,
11571,
260,
24099,
22537,
2959,
198,
197,
29928,
11571,
260,
24099... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestDomain_Renew(t *testing.T) {
t.Run("success renew from config", func(t *testing.T) {
testCtx, _ := testCtx.CacheContext()
ex := NewDomain(testCtx, testKeeper, testDomain)
ex.Renew()
newDom := new(types.Domain)
ok := testKeeper.DomainStore(testCtx).Read(testDomain.PrimaryKey(), newDom)
if !ok {
t.Fatal("domain does not exist anymore")
}
if newDom.ValidUntil != testDomain.ValidUntil+int64(testConfig.DomainRenewalPeriod.Seconds()) {
t.Fatal("mismatched times")
}
})
t.Run("success renew from account", func(t *testing.T) {
testCtx, _ := testCtx.CacheContext()
var accValidUntil int64 = 10000
ex := NewDomain(testCtx, testKeeper, testDomain)
ex.Renew(accValidUntil)
newDom := new(types.Domain)
ok := testKeeper.DomainStore(testCtx).Read(testDomain.PrimaryKey(), newDom)
if !ok {
t.Fatal("domain does not exist anymore")
}
if newDom.ValidUntil != accValidUntil {
t.Fatal("mismatched times")
}
})
} | explode_data.jsonl/16620 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 376
} | [
2830,
3393,
13636,
2568,
268,
365,
1155,
353,
8840,
836,
8,
341,
3244,
16708,
445,
5630,
13873,
504,
2193,
497,
2915,
1155,
353,
8840,
836,
8,
341,
197,
18185,
23684,
11,
716,
1669,
1273,
23684,
46130,
1972,
741,
197,
8122,
1669,
1532... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
func TestServiceBrokerExist(t *testing.T) {
// GIVEN
require.NoError(t, v1beta1.AddToScheme(scheme.Scheme))
cli := fake.NewFakeClientWithScheme(scheme.Scheme, &v1beta1.ServiceBroker{
ObjectMeta: meta_v1.ObjectMeta{
Name: fixBrokerName(),
Namespace: fixDestNs(),
}})
sut := NewBrokersFacade(cli, fixWorkingNs(), fixService(), logrus.New())
// WHEN
sut.SetNamespace(fixDestNs())
ex, err := sut.Exist()
// THEN
require.NoError(t, err)
assert.True(t, ex)
} | explode_data.jsonl/24162 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 202
} | [
2830,
3393,
1860,
65545,
25613,
1155,
353,
8840,
836,
8,
341,
197,
322,
89836,
198,
17957,
35699,
1155,
11,
348,
16,
19127,
16,
1904,
1249,
28906,
1141,
8058,
92719,
1171,
86448,
1669,
12418,
7121,
52317,
2959,
2354,
28906,
1141,
8058,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestPhotopeaPSDFail(t *testing.T) {
Debug = &testLogger{t}
testOne(testImage{
Name: "PSD(Photopea)",
PSD: "photopea.psd",
}, t)
} | explode_data.jsonl/50817 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 70
} | [
2830,
3393,
10463,
375,
64,
5012,
5262,
604,
1155,
353,
8840,
836,
8,
341,
34424,
284,
609,
1944,
7395,
90,
83,
532,
18185,
3966,
8623,
1906,
515,
197,
21297,
25,
330,
5012,
35,
97619,
375,
64,
15752,
197,
197,
5012,
35,
25,
220,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
func TestErrorToleranceRoundsToZero(t *testing.T) {
// FIXME Can't test this until can pass tolerance in
// if err != ErrorToleranceRoundsToZero {
// t.Error("Expecting", ErrorToleranceRoundsToZero, "but got", err)
// }
} | explode_data.jsonl/66844 | {
"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,
1454,
51,
31661,
49,
3095,
1249,
17999,
1155,
353,
8840,
836,
8,
341,
197,
322,
27475,
2980,
944,
1273,
419,
3080,
646,
1494,
24098,
304,
198,
197,
322,
421,
1848,
961,
4600,
51,
31661,
49,
3095,
1249,
17999,
341,
197,
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... | 1 |
func TestSserviceWin_NewDaemon(t *testing.T) {
ss := NewSService(&Option{})
d, err := ss.NewDaemon("test", "", "")
assert.Nil(t, err)
dc, _ := daem.New("test", "", "")
assert.IsType(t, d, dc)
} | explode_data.jsonl/8291 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 90
} | [
2830,
3393,
50,
7936,
16970,
39582,
89177,
1155,
353,
8840,
836,
8,
341,
34472,
1669,
1532,
1220,
1017,
2099,
5341,
37790,
2698,
11,
1848,
1669,
10870,
7121,
89177,
445,
1944,
497,
7342,
14676,
6948,
59678,
1155,
11,
1848,
340,
87249,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
func TestServer_RSTStream_Unblocks_Header_Write(t *testing.T) {
// Run this test a bunch, because it doesn't always
// deadlock. But with a bunch, it did.
n := 50
if testing.Short() {
n = 5
}
for i := 0; i < n; i++ {
testServer_RSTStream_Unblocks_Header_Write(t)
}
} | explode_data.jsonl/71645 | {
"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,
5475,
64093,
3027,
40687,
21928,
71353,
31825,
1155,
353,
8840,
836,
8,
341,
197,
322,
6452,
419,
1273,
264,
15493,
11,
1576,
432,
3171,
944,
2677,
198,
197,
322,
93345,
13,
1988,
448,
264,
15493,
11,
432,
1521,
624,
9038,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestSeekAndReadWithRetries(t *testing.T) {
mockCtrl := gomock.NewController(t)
hdfsReader := NewMockReadSeekCloser(mockCtrl)
hdfsAccessor := NewMockHdfsAccessor(mockCtrl)
ftHdfsReader := NewFaultTolerantHdfsReader("/path/to/file", hdfsReader, hdfsAccessor, atMost2Attempts())
var err error
var nr int
// Performing succesfull read of 60 bytes of requested 100 at offset 1000
hdfsReader.EXPECT().Seek(int64(1000)).Return(nil)
err = ftHdfsReader.Seek(1000)
assert.Nil(t, err)
hdfsReader.EXPECT().Read(gomock.Any()).Return(60, nil)
nr, err = ftHdfsReader.Read(make([]byte, 100))
assert.Nil(t, err)
assert.Equal(t, 60, nr)
// Now the stream should be at position 160
// Requesting one more read of 200 bytes, but this time it will fail
hdfsReader.EXPECT().Read(gomock.Any()).Return(0, errors.New("Injected failure"))
// As a result, ftHdfsReader should close the stream...
hdfsReader.EXPECT().Close().Return(nil)
// ...and invoke an OpenRead() to get new HdfsReader
newHdfsReader := NewMockReadSeekCloser(mockCtrl)
hdfsAccessor.EXPECT().OpenRead("/path/to/file").Return(newHdfsReader, nil)
// It should seek at corret position (1060), and repeat the read
newHdfsReader.EXPECT().Seek(int64(1060)).Return(nil)
newHdfsReader.EXPECT().Read(gomock.Any()).Return(150, nil)
nr, err = ftHdfsReader.Read(make([]byte, 200))
assert.Nil(t, err)
assert.Equal(t, 150, nr)
} | explode_data.jsonl/23313 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 538
} | [
2830,
3393,
39350,
3036,
4418,
2354,
12020,
4019,
1155,
353,
8840,
836,
8,
341,
77333,
15001,
1669,
342,
316,
1176,
7121,
2051,
1155,
340,
9598,
34378,
5062,
1669,
1532,
11571,
4418,
39350,
51236,
799,
30389,
15001,
340,
9598,
34378,
2988... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestReplaceFooterLinks(t *testing.T) {
inputText := `# Resource: aws_lambda_function
Provides a Lambda Function resource. Lambda allows you to trigger execution of code in response to events in AWS, enabling serverless backend solutions. The Lambda Function itself includes source code and runtime configuration.
For information about Lambda and how to use it, see [What is AWS Lambda?][1]
* (Required) The function [entrypoint][3] in your code.`
footerLinks := map[string]string{
"[1]": "https://docs.aws.amazon.com/lambda/latest/dg/welcome.html",
"[2]": "https://docs.aws.amazon.com/lambda/latest/dg/walkthrough-s3-events-adminuser-create-test-function-create-function.html",
"[3]": "https://docs.aws.amazon.com/lambda/latest/dg/walkthrough-custom-events-create-test-function.html",
}
expected := `# Resource: aws_lambda_function
Provides a Lambda Function resource. Lambda allows you to trigger execution of code in response to events in AWS, enabling serverless backend solutions. The Lambda Function itself includes source code and runtime configuration.
For information about Lambda and how to use it, see [What is AWS Lambda?](https://docs.aws.amazon.com/lambda/latest/dg/welcome.html)
* (Required) The function [entrypoint](https://docs.aws.amazon.com/lambda/latest/dg/walkthrough-custom-events-create-test-function.html) in your code.`
actual := replaceFooterLinks(inputText, footerLinks)
assert.Equal(t, expected, actual)
// Test when there are no footer link.
actual = replaceFooterLinks(inputText, nil)
assert.Equal(t, inputText, actual)
} | explode_data.jsonl/33535 | {
"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,
23107,
19445,
24089,
1155,
353,
8840,
836,
8,
341,
22427,
1178,
1669,
1565,
2,
11765,
25,
31521,
51884,
9174,
271,
197,
49022,
264,
44521,
5712,
5101,
13,
44521,
6147,
498,
311,
8183,
11320,
315,
2038,
304,
2033,
311,
4357,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestGuildEmbed(t *testing.T) {
res := []byte("{\"enabled\":true,\"channel_id\":\"41771983444115456\"}")
expects := []byte("{\"enabled\":true,\"channel_id\":41771983444115456}")
// convert to struct
guildEmbed := GuildEmbed{}
err := unmarshal(res, &guildEmbed)
if err != nil {
t.Error(err)
}
// back to json
data, err := json.Marshal(&guildEmbed)
if err != nil {
t.Error(err)
}
// match
if string(expects) != string(data) {
t.Errorf("json data differs. Got %s, wants %s", string(data), string(expects))
}
} | explode_data.jsonl/55144 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 215
} | [
2830,
3393,
72574,
25486,
1155,
353,
8840,
836,
8,
341,
10202,
1669,
3056,
3782,
99141,
15868,
11693,
1866,
52318,
10119,
842,
23488,
19,
16,
22,
22,
16,
24,
23,
18,
19,
19,
19,
16,
16,
20,
19,
20,
21,
2105,
14451,
8122,
7973,
166... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 4 |
func TestDefaultEventFilterFunc(t *testing.T) {
event := makeEvent("end-of-world", "it was fun", makeObjectReference("Pod", "pod1", "other"))
if DefaultEventFilterFunc(&event) {
t.Fatalf("DefaultEventFilterFunc should always return false")
}
} | explode_data.jsonl/59125 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 81
} | [
2830,
3393,
3675,
1556,
5632,
9626,
1155,
353,
8840,
836,
8,
341,
28302,
1669,
1281,
1556,
445,
408,
8668,
30084,
497,
330,
275,
572,
2464,
497,
1281,
1190,
8856,
445,
23527,
497,
330,
39073,
16,
497,
330,
1575,
5455,
743,
7899,
1556,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestPortForward(t *testing.T) {
testKubelet := newTestKubelet(t)
kubelet := testKubelet.kubelet
fakeRuntime := testKubelet.fakeRuntime
podName := "podFoo"
podNamespace := "nsFoo"
podID := types.UID("12345678")
fakeRuntime.PodList = []*kubecontainer.Pod{
{
ID: podID,
Name: podName,
Namespace: podNamespace,
Containers: []*kubecontainer.Container{
{
Name: "foo",
ID: kubecontainer.ContainerID{"test", "containerFoo"},
},
},
},
}
fakeCommandRunner := fakeContainerCommandRunner{}
kubelet.runner = &fakeCommandRunner
var port uint16 = 5000
stream := &fakeReadWriteCloser{}
err := kubelet.PortForward(
kubecontainer.GetPodFullName(&api.Pod{ObjectMeta: api.ObjectMeta{
UID: "12345678",
Name: podName,
Namespace: podNamespace,
}}),
"",
port,
stream,
)
if err != nil {
t.Fatalf("unexpected error: %s", err)
}
if e, a := podID, fakeCommandRunner.PodID; e != a {
t.Fatalf("container id: expected %q, got %q", e, a)
}
if e, a := port, fakeCommandRunner.Port; e != a {
t.Fatalf("port: expected %v, got %v", e, a)
}
if e, a := stream, fakeCommandRunner.Stream; e != a {
t.Fatalf("stream: expected %v, got %v", e, a)
}
} | explode_data.jsonl/43323 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 538
} | [
2830,
3393,
7084,
25925,
1155,
353,
8840,
836,
8,
341,
18185,
42,
3760,
1149,
1669,
501,
2271,
42,
3760,
1149,
1155,
340,
16463,
3760,
1149,
1669,
1273,
42,
3760,
1149,
5202,
3760,
1149,
198,
1166,
726,
15123,
1669,
1273,
42,
3760,
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 TestFilesystemVersion_ZFSFilesystemVersion(t *testing.T) {
empty := &FilesystemVersion{}
_, err:= empty.ZFSFilesystemVersion()
assert.Error(t, err)
dateInvalid := &FilesystemVersion{Creation: "foobar"}
_, err = dateInvalid.ZFSFilesystemVersion()
assert.Error(t, err)
} | explode_data.jsonl/44345 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 99
} | [
2830,
3393,
1703,
8948,
5637,
12302,
8485,
1703,
8948,
5637,
1155,
353,
8840,
836,
8,
1476,
197,
3194,
1669,
609,
1703,
8948,
5637,
16094,
197,
6878,
1848,
14209,
4287,
13476,
8485,
1703,
8948,
5637,
741,
6948,
6141,
1155,
11,
1848,
692... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestCreateGetDeleteOpenIDConnectSession(t *testing.T) {
t.Parallel()
for k, m := range fositeStores {
t.Run(fmt.Sprintf("case=%s", k), TestHelperCreateGetDeleteOpenIDConnectSession(m))
}
} | explode_data.jsonl/54417 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 74
} | [
2830,
3393,
4021,
1949,
6435,
5002,
915,
14611,
5283,
1155,
353,
8840,
836,
8,
341,
3244,
41288,
7957,
741,
2023,
595,
11,
296,
1669,
2088,
48390,
632,
69026,
341,
197,
3244,
16708,
28197,
17305,
445,
5638,
7846,
82,
497,
595,
701,
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
] | 2 |
func TestChatSrvStellarUI(t *testing.T) {
useRemoteMock = false
defer func() { useRemoteMock = true }()
ctc := makeChatTestContext(t, "TestChatSrvStellarUI", 3)
defer ctc.cleanup()
users := ctc.users()
delay := 2 * time.Second
//uid := users[0].User.GetUID().ToBytes()
listener := newServerChatListener()
ctc.as(t, users[0]).h.G().NotifyRouter.AddListener(listener)
tc := ctc.world.Tcs[users[0].Username]
ui := kbtest.NewChatUI()
declineUI := &xlmDeclineChatUI{ChatUI: ui}
ctx := ctc.as(t, users[0]).startCtx
ctc.as(t, users[0]).h.mockChatUI = ui
conv := mustCreateConversationForTest(t, ctc, users[0], chat1.TopicType_CHAT,
chat1.ConversationMembersType_IMPTEAMNATIVE, ctc.as(t, users[1]).user(), ctc.as(t, users[2]).user())
mst := &mockStellar{}
tc.G.SetStellar(mst)
tc.ChatG.StellarSender = wallet.NewSender(tc.Context())
specSuccess := func(payments []libkb.MiniChatPayment) (res *libkb.MiniChatPaymentSummary, err error) {
res = new(libkb.MiniChatPaymentSummary)
res.XLMTotal = "10 XLM"
res.DisplayTotal = "10 USD"
for _, p := range payments {
res.Specs = append(res.Specs, libkb.MiniChatPaymentSpec{
Username: p.Username,
XLMAmount: p.Amount + " XLM",
})
}
return res, nil
}
specFail := func(payments []libkb.MiniChatPayment) (res *libkb.MiniChatPaymentSummary, err error) {
return res, errors.New("failed")
}
successCase := func(expectError bool) {
mst.specFn = specSuccess
_, err := ctc.as(t, users[0]).chatLocalHandler().PostTextNonblock(ctx,
chat1.PostTextNonblockArg{
ConversationID: conv.Id,
TlfName: conv.TlfName,
Body: fmt.Sprintf("+1xlm@%s +5xlm@%s", users[1].Username, users[2].Username),
})
if expectError {
require.Error(t, err)
} else {
require.NoError(t, err)
}
select {
case <-ui.StellarShowConfirm:
case <-time.After(delay):
require.Fail(t, "no confirm")
}
select {
case data := <-ui.StellarDataConfirm:
require.Equal(t, 2, len(data.Payments))
require.Equal(t, "10 XLM", data.XlmTotal)
require.Equal(t, "1 XLM", data.Payments[0].XlmAmount)
require.Equal(t, "5 XLM", data.Payments[1].XlmAmount)
require.Equal(t, users[1].Username, data.Payments[0].Username)
require.Equal(t, users[2].Username, data.Payments[1].Username)
case <-time.After(delay):
require.Fail(t, "no confirm")
}
select {
case <-ui.StellarDone:
case <-time.After(delay):
require.Fail(t, "no done")
}
if !expectError {
consumeNewPendingMsg(t, listener)
select {
case msg := <-listener.newMessageLocal:
require.True(t, msg.Message.IsValid())
require.Equal(t, 2, len(msg.Message.Valid().AtMentions))
case <-time.After(delay):
require.Fail(t, "no local msg")
}
select {
case msg := <-listener.newMessageRemote:
require.True(t, msg.Message.IsValid())
require.Equal(t, 2, len(msg.Message.Valid().AtMentions))
case <-time.After(delay):
require.Fail(t, "no remote msg")
}
}
}
t.Logf("success accept")
successCase(false)
t.Logf("success decline")
ctc.as(t, users[0]).h.mockChatUI = declineUI
successCase(true)
ctc.as(t, users[0]).h.mockChatUI = ui
t.Logf("fail")
mst.specFn = specFail
_, err := ctc.as(t, users[0]).chatLocalHandler().PostTextNonblock(ctx, chat1.PostTextNonblockArg{
ConversationID: conv.Id,
TlfName: conv.TlfName,
Body: fmt.Sprintf("+1xlm@%s +5xlm@%s", users[1].Username, users[2].Username),
})
require.Error(t, err)
select {
case <-ui.StellarShowConfirm:
case <-time.After(delay):
require.Fail(t, "no confirm")
}
select {
case <-ui.StellarDataConfirm:
require.Fail(t, "no confirm")
default:
}
select {
case <-ui.StellarDataError:
case <-time.After(delay):
require.Fail(t, "no error")
}
select {
case <-ui.StellarDone:
case <-time.After(delay):
require.Fail(t, "no done")
}
t.Logf("no payments")
_, err = ctc.as(t, users[0]).chatLocalHandler().PostTextNonblock(ctx, chat1.PostTextNonblockArg{
ConversationID: conv.Id,
TlfName: conv.TlfName,
Body: "pay me back",
})
require.NoError(t, err)
select {
case <-ui.StellarShowConfirm:
require.Fail(t, "confirm")
default:
}
consumeNewPendingMsg(t, listener)
} | explode_data.jsonl/63722 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 1865
} | [
2830,
3393,
15672,
50,
10553,
623,
26880,
2275,
1155,
353,
8840,
836,
8,
341,
41819,
24703,
11571,
284,
895,
198,
16867,
2915,
368,
314,
990,
24703,
11571,
284,
830,
50746,
89216,
66,
1669,
1281,
15672,
2271,
1972,
1155,
11,
330,
2271,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestRetriesOnFailures(t *testing.T) {
agentInfo := &testAgentInfo{}
settings := &fleetGatewaySettings{
Duration: 5 * time.Second,
Backoff: backoffSettings{Init: 100 * time.Millisecond, Max: 5 * time.Second},
}
t.Run("When the gateway fails to communicate with the checkin API we will retry",
withGateway(agentInfo, settings, func(
t *testing.T,
gateway FleetGateway,
client *testingClient,
dispatcher *testingDispatcher,
scheduler *scheduler.Stepper,
rep repo.Backend,
) {
fail := func(_ http.Header, _ io.Reader) (*http.Response, error) {
return wrapStrToResp(http.StatusInternalServerError, "something is bad"), nil
}
clientWaitFn := client.Answer(fail)
gateway.Start()
rep.Report(context.Background(), &testStateEvent{})
// Initial tick is done out of bound so we can block on channels.
scheduler.Next()
// Simulate a 500 errors for the next 3 calls.
<-clientWaitFn
<-clientWaitFn
<-clientWaitFn
// API recover
waitFn := ackSeq(
client.Answer(func(_ http.Header, body io.Reader) (*http.Response, error) {
cr := &request{}
content, err := ioutil.ReadAll(body)
if err != nil {
t.Fatal(err)
}
err = json.Unmarshal(content, &cr)
if err != nil {
t.Fatal(err)
}
require.Equal(t, 1, len(cr.Events))
resp := wrapStrToResp(http.StatusOK, `{ "actions": [] }`)
return resp, nil
}),
dispatcher.Answer(func(actions ...action) error {
require.Equal(t, 0, len(actions))
return nil
}),
)
waitFn()
}))
t.Run("The retry loop is interruptible",
withGateway(agentInfo, &fleetGatewaySettings{
Duration: 0 * time.Second,
Backoff: backoffSettings{Init: 10 * time.Minute, Max: 20 * time.Minute},
}, func(
t *testing.T,
gateway FleetGateway,
client *testingClient,
dispatcher *testingDispatcher,
scheduler *scheduler.Stepper,
rep repo.Backend,
) {
fail := func(_ http.Header, _ io.Reader) (*http.Response, error) {
return wrapStrToResp(http.StatusInternalServerError, "something is bad"), nil
}
waitChan := client.Answer(fail)
gateway.Start()
rep.Report(context.Background(), &testStateEvent{})
// Initial tick is done out of bound so we can block on channels.
scheduler.Next()
// Fail to enter retry loop, all other calls will fails and will force to wait on big initial
// delay.
<-waitChan
// non-obvious but withGateway on return will stop the gateway before returning and we should
// exit the retry loop. The init value of the backoff is set to exceed the test default timeout.
}))
} | explode_data.jsonl/80448 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 1028
} | [
2830,
3393,
12020,
4019,
1925,
19524,
1413,
1155,
353,
8840,
836,
8,
341,
197,
8092,
1731,
1669,
609,
1944,
16810,
1731,
16094,
62930,
1669,
609,
72698,
40709,
6086,
515,
197,
10957,
2017,
25,
220,
20,
353,
882,
32435,
345,
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 TestGetDbUrl(t *testing.T) {
assert.Equal(t, "localhost", DBUrl())
os.Setenv("MONGOHQ_URL", "abc")
assert.Equal(t, "abc", DBUrl())
cleanEnv()
} | explode_data.jsonl/18077 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 67
} | [
2830,
3393,
1949,
7994,
2864,
1155,
353,
8840,
836,
8,
1476,
6948,
12808,
1155,
11,
330,
8301,
497,
5952,
2864,
12367,
25078,
4202,
3160,
445,
44,
7539,
46761,
48,
8000,
497,
330,
13683,
5130,
6948,
12808,
1155,
11,
330,
13683,
497,
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 |
func TestIndexEditorConcurrency(t *testing.T) {
format := types.Format_Default
db, err := dbfactory.MemFactory{}.CreateDB(context.Background(), format, nil, nil)
require.NoError(t, err)
colColl := schema.NewColCollection(
schema.NewColumn("pk", 0, types.IntKind, true),
schema.NewColumn("v1", 1, types.IntKind, false),
schema.NewColumn("v2", 2, types.IntKind, false))
tableSch, err := schema.SchemaFromCols(colColl)
require.NoError(t, err)
index, err := tableSch.Indexes().AddIndexByColNames("idx_concurrency", []string{"v1"}, schema.IndexProperties{IsUnique: false, Comment: ""})
require.NoError(t, err)
indexSch := index.Schema()
emptyMap, err := types.NewMap(context.Background(), db)
require.NoError(t, err)
for i := 0; i < indexEditorConcurrencyIterations; i++ {
indexEditor := NewIndexEditor(context.Background(), index, emptyMap, tableSch)
wg := &sync.WaitGroup{}
for j := 0; j < indexEditorConcurrencyFinalCount*2; j++ {
wg.Add(1)
go func(val int) {
dRow, err := row.New(format, indexSch, row.TaggedValues{
0: types.Int(val),
1: types.Int(val),
})
require.NoError(t, err)
fullKey, partialKey, value, err := dRow.ReduceToIndexKeys(index)
require.NoError(t, err)
require.NoError(t, indexEditor.InsertRow(context.Background(), fullKey, partialKey, value))
wg.Done()
}(j)
}
wg.Wait()
for j := 0; j < indexEditorConcurrencyFinalCount; j++ {
wg.Add(1)
go func(val int) {
dOldRow, err := row.New(format, indexSch, row.TaggedValues{
0: types.Int(val),
1: types.Int(val),
})
require.NoError(t, err)
dNewRow, err := row.New(format, indexSch, row.TaggedValues{
0: types.Int(val),
1: types.Int(val + 1),
})
require.NoError(t, err)
oldFullKey, oldPartialKey, _, err := dOldRow.ReduceToIndexKeys(index)
require.NoError(t, err)
require.NoError(t, indexEditor.DeleteRow(context.Background(), oldFullKey, oldPartialKey, types.EmptyTuple(format)))
newFullKey, newPartialKey, newValue, err := dNewRow.ReduceToIndexKeys(index)
require.NoError(t, err)
require.NoError(t, indexEditor.InsertRow(context.Background(), newFullKey, newPartialKey, newValue))
wg.Done()
}(j)
}
// We let the Updates and Deletes execute at the same time
for j := indexEditorConcurrencyFinalCount; j < indexEditorConcurrencyFinalCount*2; j++ {
wg.Add(1)
go func(val int) {
dRow, err := row.New(format, indexSch, row.TaggedValues{
0: types.Int(val),
1: types.Int(val),
})
require.NoError(t, err)
fullKey, partialKey, _, err := dRow.ReduceToIndexKeys(index)
require.NoError(t, err)
require.NoError(t, indexEditor.DeleteRow(context.Background(), fullKey, partialKey, types.EmptyTuple(format)))
wg.Done()
}(j)
}
wg.Wait()
newIndexData, err := indexEditor.Map(context.Background())
require.NoError(t, err)
if assert.Equal(t, uint64(indexEditorConcurrencyFinalCount), newIndexData.Len()) {
iterIndex := 0
_ = newIndexData.IterAll(context.Background(), func(key, value types.Value) error {
dReadRow, err := row.FromNoms(indexSch, key.(types.Tuple), value.(types.Tuple))
require.NoError(t, err)
dReadVals, err := dReadRow.TaggedValues()
require.NoError(t, err)
assert.Equal(t, row.TaggedValues{
0: types.Int(iterIndex),
1: types.Int(iterIndex + 1),
}, dReadVals)
iterIndex++
return nil
})
}
}
} | explode_data.jsonl/27205 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 1416
} | [
2830,
3393,
1552,
9410,
79611,
1155,
353,
8840,
836,
8,
341,
59416,
1669,
4494,
9978,
60336,
198,
20939,
11,
1848,
1669,
2927,
21618,
1321,
336,
4153,
46391,
4021,
3506,
5378,
19047,
1507,
3561,
11,
2092,
11,
2092,
340,
17957,
35699,
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 TestIssue325(t *testing.T) {
// nil pointer dereference when evaluating interfaces to function pointers
protest.AllowRecording(t)
withTestProcess("testvariables2", t, func(p *proc.Target, fixture protest.Fixture) {
assertNoError(p.Continue(), t, "Continue()")
iface2fn1v := evalVariable(p, t, "iface2fn1")
t.Logf("iface2fn1: %v\n", iface2fn1v)
iface2fn2v := evalVariable(p, t, "iface2fn2")
t.Logf("iface2fn2: %v\n", iface2fn2v)
})
} | explode_data.jsonl/56232 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 186
} | [
2830,
3393,
42006,
18,
17,
20,
1155,
353,
8840,
836,
8,
341,
197,
322,
2092,
7445,
25277,
2202,
979,
37563,
24099,
311,
729,
27454,
198,
197,
776,
1944,
29081,
52856,
1155,
340,
46948,
2271,
7423,
445,
1944,
18616,
17,
497,
259,
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 TestExecuteTask(t *testing.T) {
err := action.RegisterExecutor(ActionTypeTestProcessorMockup, new(executorMockupForProcessorTest))
assert.NoError(t, err)
err = RegisterProcessor(TaskTypeTestProcessorMockup1, new(processorMockupForProcessorTest1))
assert.NoError(t, err)
err = RegisterProcessor(TaskTypeTestProcessorMockup2, new(processorMockupForProcessorTest2))
assert.NoError(t, err)
err = RegisterProcessor(TaskTypeTestProcessorMockup3, new(processorMockupForProcessorTest3))
assert.NoError(t, err)
task1 := &taskMockupForProcessorTest1{
Base: Base{
Name: "task1",
TaskType: TaskTypeTestProcessorMockup1,
Status: TaskPending,
},
}
err = ExecuteTask(task1)
assert.NoError(t, err)
assert.Equal(t, TaskSuccessful, task1.GetStatus())
assert.Nil(t, task1.GetErr())
assert.Equal(t, 2, len(task1.GetSubTasks()))
assert.Equal(t, 0, len(task1.GetActions()))
for _, subTask := range task1.GetSubTasks() {
assert.Equal(t, TaskSuccessful, subTask.GetStatus())
assert.Nil(t, subTask.GetErr())
assert.Equal(t, 0, len(subTask.GetSubTasks()))
assert.Equal(t, 1, len(subTask.GetActions()))
for _, act := range subTask.GetActions() {
assert.Equal(t, action.ActionDone, act.GetStatus())
assert.Nil(t, act.GetErr())
}
}
// cleanup
_processRegistry = nil
} | explode_data.jsonl/45101 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 527
} | [
2830,
3393,
17174,
6262,
1155,
353,
8840,
836,
8,
341,
9859,
1669,
1917,
19983,
25255,
21905,
929,
2271,
22946,
11571,
454,
11,
501,
46896,
4831,
11571,
454,
2461,
22946,
2271,
1171,
6948,
35699,
1155,
11,
1848,
692,
9859,
284,
8451,
22... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
func TestTChannelLoggerLeveledMethods(t *testing.T) {
withLogger(zap.DebugLevel, func(logger tchannel.Logger, logs *observer.ObservedLogs) {
tests := []struct {
method func(string)
methodf func(string, ...interface{})
expectedLevel zapcore.Level
}{
{method: logger.Debug, expectedLevel: zap.DebugLevel},
{method: logger.Info, expectedLevel: zap.InfoLevel},
{method: logger.Warn, expectedLevel: zap.WarnLevel},
{method: logger.Error, expectedLevel: zap.ErrorLevel},
{methodf: logger.Infof, expectedLevel: zap.InfoLevel},
{methodf: logger.Debugf, expectedLevel: zap.DebugLevel},
}
for i, tt := range tests {
if tt.method == nil {
tt.methodf("%s", "")
} else {
tt.method("")
}
output := logs.AllUntimed()
assert.Equal(t, i+1, len(output), "Unexpected number of logs.")
assert.Equal(t, 0, len(output[i].Context), "Unexpected context on first log.")
assert.Equal(
t,
zapcore.Entry{Level: tt.expectedLevel},
output[i].Entry,
"Unexpected output from %s-level logger method.", tt.expectedLevel)
}
})
} | explode_data.jsonl/22079 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 446
} | [
2830,
3393,
51,
9629,
7395,
2304,
93964,
17856,
1155,
353,
8840,
836,
8,
341,
46948,
7395,
13174,
391,
20345,
4449,
11,
2915,
37833,
259,
10119,
12750,
11,
18422,
353,
30730,
8382,
1279,
2771,
51053,
8,
341,
197,
78216,
1669,
3056,
1235... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestPrivateCalico(t *testing.T) {
runTestAWS(t, "privatecalico.example.com", "privatecalico", "v1alpha1", true, 1, true)
runTestAWS(t, "privatecalico.example.com", "privatecalico", "v1alpha2", true, 1, true)
} | explode_data.jsonl/25369 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 85
} | [
2830,
3393,
16787,
8851,
3955,
1155,
353,
8840,
836,
8,
341,
56742,
2271,
36136,
1155,
11,
330,
1996,
5416,
3955,
7724,
905,
497,
330,
1996,
5416,
3955,
497,
330,
85,
16,
7141,
16,
497,
830,
11,
220,
16,
11,
830,
340,
56742,
2271,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestFromASCII85(t *testing.T) {
type args struct {
r io.Reader
}
tests := []struct {
name string
args args
want string
}{
{
name: "TestOne",
args: args{r: strings.NewReader("<+oue+DGm>Df0B:+CQC7ATMq")},
want: "This is only a test",
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
if got, _ := io.ReadAll(FromASCII85(tt.args.r)); strings.Compare(string(got), tt.want) != 0 {
t.Errorf("FromASCII85() = %v, want %v", string(got), tt.want)
}
})
}
} | explode_data.jsonl/46460 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 246
} | [
2830,
3393,
3830,
56450,
23,
20,
1155,
353,
8840,
836,
8,
341,
13158,
2827,
2036,
341,
197,
7000,
6399,
47431,
198,
197,
532,
78216,
1669,
3056,
1235,
341,
197,
11609,
914,
198,
197,
31215,
2827,
198,
197,
50780,
914,
198,
197,
59403,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestMigrate(t *testing.T) {
s := &Stub{}
d, err := s.Open("")
if err != nil {
t.Fatal(err)
}
stubMigrations := source.NewMigrations()
stubMigrations.Append(&source.Migration{Version: 1, Direction: source.Up, Identifier: "CREATE 1"})
stubMigrations.Append(&source.Migration{Version: 1, Direction: source.Down, Identifier: "DROP 1"})
src := &stub.Stub{}
srcDrv, err := src.Open("")
srcDrv.(*stub.Stub).Migrations = stubMigrations
m, err := migrate.NewWithInstance("stub", srcDrv, "", d)
if err != nil {
t.Fatalf("%v", err)
}
dt.TestMigrate(t, m, []byte("/* foobar migration */"))
} | explode_data.jsonl/11807 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 252
} | [
2830,
3393,
44,
34479,
1155,
353,
8840,
836,
8,
341,
1903,
1669,
609,
33838,
16094,
2698,
11,
1848,
1669,
274,
12953,
31764,
743,
1848,
961,
2092,
341,
197,
3244,
26133,
3964,
340,
197,
630,
18388,
392,
44,
17824,
1669,
2530,
7121,
44... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
func TestPodDelete(t *testing.T) {
c, _ := newTestClient(t)
podAddAndUpdateTest(t, c, c.handlePodAdd)
assert.Equal(t, len(c.Pods), 3)
assert.Equal(t, c.Pods["1.1.1.1"].Address, "1.1.1.1")
// delete empty IP pod
c.handlePodDelete(&api_v1.Pod{})
// delete non-existent IP
pod := &api_v1.Pod{}
pod.Status.PodIP = "9.9.9.9"
c.handlePodDelete(pod)
assert.Equal(t, len(c.Pods), 3)
got := c.Pods["1.1.1.1"]
assert.Equal(t, got.Address, "1.1.1.1")
assert.Equal(t, len(c.deleteQueue), 0)
// delete matching IP with wrong name/different pod
pod = &api_v1.Pod{}
pod.Status.PodIP = "1.1.1.1"
c.handlePodDelete(pod)
got = c.Pods["1.1.1.1"]
assert.Equal(t, len(c.Pods), 3)
assert.Equal(t, got.Address, "1.1.1.1")
assert.Equal(t, len(c.deleteQueue), 0)
// delete matching IP and name
pod = &api_v1.Pod{}
pod.Name = "podB"
pod.Status.PodIP = "1.1.1.1"
tsBeforeDelete := time.Now()
c.handlePodDelete(pod)
assert.Equal(t, len(c.Pods), 3)
assert.Equal(t, len(c.deleteQueue), 1)
deleteRequest := c.deleteQueue[0]
assert.Equal(t, deleteRequest.id, PodIdentifier("1.1.1.1"))
assert.Equal(t, deleteRequest.podName, "podB")
assert.False(t, deleteRequest.ts.Before(tsBeforeDelete))
assert.False(t, deleteRequest.ts.After(time.Now()))
pod = &api_v1.Pod{}
pod.Name = "podC"
pod.Status.PodIP = "2.2.2.2"
pod.UID = "aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee"
tsBeforeDelete = time.Now()
c.handlePodDelete(pod)
assert.Equal(t, len(c.Pods), 3)
assert.Equal(t, len(c.deleteQueue), 3)
deleteRequest = c.deleteQueue[1]
assert.Equal(t, deleteRequest.id, PodIdentifier("2.2.2.2"))
assert.Equal(t, deleteRequest.podName, "podC")
assert.False(t, deleteRequest.ts.Before(tsBeforeDelete))
assert.False(t, deleteRequest.ts.After(time.Now()))
deleteRequest = c.deleteQueue[2]
assert.Equal(t, deleteRequest.id, PodIdentifier("aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee"))
assert.Equal(t, deleteRequest.podName, "podC")
assert.False(t, deleteRequest.ts.Before(tsBeforeDelete))
assert.False(t, deleteRequest.ts.After(time.Now()))
} | explode_data.jsonl/56847 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 892
} | [
2830,
3393,
23527,
6435,
1155,
353,
8840,
836,
8,
341,
1444,
11,
716,
1669,
501,
2271,
2959,
1155,
340,
3223,
347,
2212,
56365,
2271,
1155,
11,
272,
11,
272,
10132,
23527,
2212,
340,
6948,
12808,
1155,
11,
2422,
1337,
1069,
29697,
701... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestSpanCountWithEmpty(t *testing.T) {
assert.EqualValues(t, 0, Traces{orig: &otlptrace.TracesData{
ResourceSpans: []*otlptrace.ResourceSpans{{}},
}}.SpanCount())
assert.EqualValues(t, 0, Traces{orig: &otlptrace.TracesData{
ResourceSpans: []*otlptrace.ResourceSpans{
{
InstrumentationLibrarySpans: []*otlptrace.InstrumentationLibrarySpans{{}},
},
},
}}.SpanCount())
assert.EqualValues(t, 1, Traces{orig: &otlptrace.TracesData{
ResourceSpans: []*otlptrace.ResourceSpans{
{
InstrumentationLibrarySpans: []*otlptrace.InstrumentationLibrarySpans{
{
Spans: []*otlptrace.Span{{}},
},
},
},
},
}}.SpanCount())
} | explode_data.jsonl/79476 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 302
} | [
2830,
3393,
12485,
2507,
2354,
3522,
1155,
353,
8840,
836,
8,
341,
6948,
12808,
6227,
1155,
11,
220,
15,
11,
1163,
2434,
90,
4670,
25,
609,
354,
75,
3505,
578,
8240,
2434,
1043,
515,
197,
79487,
6406,
596,
25,
29838,
354,
75,
3505,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestHandleDeleteServiceInstanceSuccess(t *testing.T) {
ctx := context.Background()
getServiceClassFn := refs.NewFakeServiceClassGetterFunc(&data.ServiceClass{}, nil)
getServiceBrokerFn := refs.NewFakeServiceBrokerGetterFunc(&data.ServiceBroker{}, nil)
deprovisioner := fake.NewDeprovisioner()
lifecycler := &fake.Lifecycler{
Deprovisioner: deprovisioner,
}
inst := new(data.ServiceInstance)
inst.Kind = data.ServiceInstanceKind
evt := watch.Event{
Type: watch.Deleted,
Object: inst,
}
err := handleDeleteServiceInstance(ctx, lifecycler, getServiceClassFn, getServiceBrokerFn, evt)
assert.NoErr(t, err)
assert.Equal(t, len(deprovisioner.Reqs), 1, "number of deprovision requests")
} | explode_data.jsonl/72431 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 257
} | [
2830,
3393,
6999,
6435,
1860,
2523,
7188,
1155,
353,
8840,
836,
8,
341,
20985,
1669,
2266,
19047,
741,
10366,
1860,
1957,
24911,
1669,
43143,
7121,
52317,
1860,
1957,
31485,
9626,
2099,
691,
13860,
1957,
22655,
2092,
340,
10366,
1860,
655... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestSStx(t *testing.T) {
var sstx = dcrutil.NewTx(sstxMsgTx)
sstx.SetTree(wire.TxTreeStake)
sstx.SetIndex(0)
err := stake.CheckSStx(sstx.MsgTx())
if err != nil {
t.Errorf("CheckSStx: unexpected err: %v", err)
}
if !stake.IsSStx(sstx.MsgTx()) {
t.Errorf("IsSStx claimed a valid sstx is invalid")
}
// ---------------------------------------------------------------------------
// Test for an OP_RETURN commitment push of the maximum size
biggestPush := []byte{
0x6a, 0x4b, // OP_RETURN Push 75-bytes
0x14, 0x94, 0x8c, 0x76, 0x5a, 0x69, 0x14, 0xd4, // 75 bytes
0x3f, 0x2a, 0x7a, 0xc1, 0x77, 0xda, 0x2c, 0x2f,
0x6b, 0x52, 0xde, 0x3d, 0x7c, 0x7c, 0x7c, 0x7c,
0x6b, 0x52, 0xde, 0x3d, 0x7c, 0x7c, 0x7c, 0x7c,
0x6b, 0x52, 0xde, 0x3d, 0x7c, 0x7c, 0x7c, 0x7c,
0x6b, 0x52, 0xde, 0x3d, 0x7c, 0x7c, 0x7c, 0x7c,
0x6b, 0x52, 0xde, 0x3d, 0x7c, 0x7c, 0x7c, 0x7c,
0x6b, 0x52, 0xde, 0x3d, 0x7c, 0x7c, 0x7c, 0x7c,
0x6b, 0x52, 0xde, 0x3d, 0x7c, 0x7c, 0x7c, 0x7c,
0x6b, 0x52, 0xde,
}
sstx = dcrutil.NewTxDeep(sstxMsgTx)
sstx.MsgTx().TxOut[1].PkScript = biggestPush
sstx.SetTree(wire.TxTreeStake)
sstx.SetIndex(0)
err = stake.CheckSStx(sstx.MsgTx())
if err != nil {
t.Errorf("CheckSStx: unexpected err: %v", err)
}
if !stake.IsSStx(sstx.MsgTx()) {
t.Errorf("IsSStx claimed a valid sstx is invalid")
}
} | explode_data.jsonl/70506 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 753
} | [
2830,
3393,
50,
623,
87,
1155,
353,
8840,
836,
8,
341,
2405,
274,
267,
87,
284,
294,
5082,
1314,
7121,
31584,
1141,
267,
87,
6611,
31584,
340,
1903,
267,
87,
4202,
6533,
3622,
554,
81362,
6533,
623,
726,
340,
1903,
267,
87,
4202,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestGitCommandCommit(t *testing.T) {
type scenario struct {
testName string
command func(string, ...string) *exec.Cmd
getGlobalGitConfig func(string) (string, error)
test func(*exec.Cmd, error)
}
scenarios := []scenario{
{
"Commit using gpg",
func(cmd string, args ...string) *exec.Cmd {
assert.EqualValues(t, "bash", cmd)
assert.EqualValues(t, []string{"-c", `git commit -m 'test'`}, args)
return exec.Command("echo")
},
func(string) (string, error) {
return "true", nil
},
func(cmd *exec.Cmd, err error) {
assert.NotNil(t, cmd)
assert.Nil(t, err)
},
},
{
"Commit without using gpg",
func(cmd string, args ...string) *exec.Cmd {
assert.EqualValues(t, "git", cmd)
assert.EqualValues(t, []string{"commit", "-m", "test"}, args)
return exec.Command("echo")
},
func(string) (string, error) {
return "false", nil
},
func(cmd *exec.Cmd, err error) {
assert.Nil(t, cmd)
assert.Nil(t, err)
},
},
{
"Commit without using gpg with an error",
func(cmd string, args ...string) *exec.Cmd {
assert.EqualValues(t, "git", cmd)
assert.EqualValues(t, []string{"commit", "-m", "test"}, args)
return exec.Command("test")
},
func(string) (string, error) {
return "false", nil
},
func(cmd *exec.Cmd, err error) {
assert.Nil(t, cmd)
assert.Error(t, err)
},
},
}
for _, s := range scenarios {
t.Run(s.testName, func(t *testing.T) {
gitCmd := newDummyGitCommand()
gitCmd.getGlobalGitConfig = s.getGlobalGitConfig
gitCmd.OSCommand.command = s.command
s.test(gitCmd.Commit("test"))
})
}
} | explode_data.jsonl/38369 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 765
} | [
2830,
3393,
46562,
4062,
33441,
1155,
353,
8840,
836,
8,
341,
13158,
15048,
2036,
341,
197,
18185,
675,
1843,
914,
198,
197,
45566,
310,
2915,
3609,
11,
2503,
917,
8,
353,
11748,
64512,
198,
197,
10366,
11646,
46562,
2648,
2915,
3609,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestGetAndCheckRefs(t *testing.T) {
type expected struct {
baseSHA string
headSHAs []string
err string
}
for _, tc := range []struct {
name string
baseSHAGetter RefGetter
headSHAGetters []RefGetter
expected expected
}{
{
name: "Basic",
baseSHAGetter: goodSHAGetter("ba5e"),
headSHAGetters: []RefGetter{
goodSHAGetter("abcd"),
goodSHAGetter("ef01")},
expected: expected{
baseSHA: "ba5e",
headSHAs: []string{"abcd", "ef01"},
err: "",
},
},
{
name: "NoHeadSHAGetters",
baseSHAGetter: goodSHAGetter("ba5e"),
headSHAGetters: []RefGetter{},
expected: expected{
baseSHA: "ba5e",
headSHAs: nil,
err: "",
},
},
{
name: "BaseSHAGetterFailure",
baseSHAGetter: badSHAGetter,
headSHAGetters: []RefGetter{
goodSHAGetter("abcd"),
goodSHAGetter("ef01")},
expected: expected{
baseSHA: "",
headSHAs: nil,
err: "failed to get baseSHA: badSHAGetter",
},
},
{
name: "HeadSHAGetterFailure",
baseSHAGetter: goodSHAGetter("ba5e"),
headSHAGetters: []RefGetter{
goodSHAGetter("abcd"),
badSHAGetter},
expected: expected{
baseSHA: "",
headSHAs: nil,
err: "failed to get headRef: badSHAGetter",
},
},
} {
t.Run(tc.name, func(t1 *testing.T) {
baseSHA, headSHAs, err := GetAndCheckRefs(tc.baseSHAGetter, tc.headSHAGetters...)
if tc.expected.err == "" {
if err != nil {
t.Errorf("Expected error 'nil' got '%v'", err.Error())
}
if tc.expected.baseSHA != baseSHA {
t.Errorf("Expected baseSHA '%v', got '%v'", tc.expected.baseSHA, baseSHA)
}
if !reflect.DeepEqual(tc.expected.headSHAs, headSHAs) {
t.Errorf("headSHAs do not match:\n%s", diff.ObjectReflectDiff(tc.expected.headSHAs, headSHAs))
}
} else {
if err == nil {
t.Fatal("Expected non-nil error, got nil")
}
if tc.expected.err != err.Error() {
t.Errorf("Expected error '%v', got '%v'", tc.expected.err, err.Error())
}
}
})
}
} | explode_data.jsonl/41059 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 1020
} | [
2830,
3393,
1949,
3036,
3973,
82807,
1155,
353,
8840,
836,
8,
341,
13158,
3601,
2036,
341,
197,
24195,
33145,
220,
914,
198,
197,
46081,
8590,
2121,
3056,
917,
198,
197,
9859,
414,
914,
198,
197,
630,
2023,
8358,
17130,
1669,
2088,
30... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestReflect_notptr(t *testing.T) {
var v, actual int = 42, 0
b := make([]byte, 8)
lex.PutInt(b, v)
lex.Reflect(b, actual)
assert.Equal(t, 0, actual)
} | explode_data.jsonl/50154 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 74
} | [
2830,
3393,
72789,
7913,
3505,
1155,
353,
8840,
836,
8,
341,
2405,
348,
11,
5042,
526,
284,
220,
19,
17,
11,
220,
15,
271,
2233,
1669,
1281,
10556,
3782,
11,
220,
23,
340,
197,
2571,
39825,
1072,
1883,
11,
348,
692,
197,
2571,
183... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestFetchOrder(t *testing.T) {
t.Parallel()
if !areTestAPIKeysSet() {
t.Skip("API keys required but not set, skipping test")
}
_, err := b.FetchOrder("4477045999")
if err != nil {
t.Error(err)
}
_, err = b.FetchOrder("696969")
if err == nil {
t.Error(err)
}
} | explode_data.jsonl/33155 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 124
} | [
2830,
3393,
20714,
4431,
1155,
353,
8840,
836,
8,
341,
3244,
41288,
7957,
741,
743,
753,
546,
2271,
7082,
8850,
1649,
368,
341,
197,
3244,
57776,
445,
7082,
6894,
2567,
714,
537,
738,
11,
42659,
1273,
1138,
197,
532,
197,
6878,
1848,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 4 |
func TestSaveYAML(t *testing.T) {
filename1 := "./util_test.yaml"
object1 := map[string]int{"a":2}
filename2 := "./unknown_directory/util_test.yaml"
// cleanup routine
defer func() {
os.Remove(filename1)
}()
// save yaml from non existing file
err := SaveYAML(filename1, &object1)
if err != nil {
t.Errorf("SaveYAML failed:\n%s", err)
}
// try to save yaml twice
err = SaveYAML(filename2, &object1)
if err == nil {
t.Errorf("SaveYAML should have failed when attempting to save entity")
}
} | explode_data.jsonl/52980 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 205
} | [
2830,
3393,
8784,
56,
31102,
1155,
353,
8840,
836,
8,
341,
220,
3899,
16,
1669,
5924,
1314,
4452,
33406,
698,
220,
1633,
16,
256,
1669,
2415,
14032,
63025,
4913,
64,
788,
17,
532,
220,
3899,
17,
1669,
5924,
16088,
14846,
22610,
4452,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestUnmarshalBinarySet(t *testing.T) {
input := []byte(`{ "BS": ["AAEqQQ==", "AAEqQQ=="] }`)
var av DynamoDBAttributeValue
err := json.Unmarshal(input, &av)
assert.Nil(t, err)
assert.Equal(t, DataTypeBinarySet, av.DataType())
assert.Equal(t, 2, len(av.BinarySet()))
assert.Equal(t, "AAEqQQ==", base64.StdEncoding.EncodeToString(av.BinarySet()[1]))
} | explode_data.jsonl/61695 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 167
} | [
2830,
3393,
1806,
27121,
21338,
1649,
1155,
353,
8840,
836,
8,
341,
22427,
1669,
3056,
3782,
5809,
90,
330,
7347,
788,
4383,
6029,
27312,
48026,
418,
497,
330,
6029,
27312,
48026,
418,
1341,
335,
63,
692,
2405,
1822,
71813,
3506,
78554,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestPreventDestroyOverride(t *testing.T) {
t.Parallel()
cleanupTerraformFolder(t, TEST_FIXTURE_PREVENT_DESTROY_OVERRIDE)
assert.NoError(t, runTerragruntCommand(t, fmt.Sprintf("terragrunt apply -auto-approve --terragrunt-working-dir %s", TEST_FIXTURE_PREVENT_DESTROY_OVERRIDE), os.Stdout, os.Stderr))
assert.NoError(t, runTerragruntCommand(t, fmt.Sprintf("terragrunt destroy -auto-approve --terragrunt-working-dir %s", TEST_FIXTURE_PREVENT_DESTROY_OVERRIDE), os.Stdout, os.Stderr))
} | explode_data.jsonl/10105 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 204
} | [
2830,
3393,
4703,
684,
14245,
2177,
1155,
353,
8840,
836,
8,
341,
3244,
41288,
7957,
2822,
1444,
60639,
51,
13886,
627,
13682,
1155,
11,
13602,
42635,
41486,
17427,
6784,
79400,
49372,
692,
6948,
35699,
1155,
11,
1598,
51402,
68305,
3850,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestSelectParallel(t *testing.T) {
if TestDisableDatabase {
t.SkipNow()
}
ctx, cancel := context.WithTimeout(context.Background(), TestContextTimeout)
stmt, err := TestDB.PrepareContext(ctx, "select :1 from dual")
cancel()
if err != nil {
t.Fatal("prepare error:", err)
}
var waitGroup sync.WaitGroup
waitGroup.Add(50)
for i := 0; i < 50; i++ {
go func(num int) {
defer waitGroup.Done()
var result [][]interface{}
result, err = testGetRows(t, stmt, []interface{}{num})
if err != nil {
t.Fatal("get rows error:", err)
}
if result == nil {
t.Fatal("result is nil")
}
if len(result) != 1 {
t.Fatal("len result not equal to 1")
}
if len(result[0]) != 1 {
t.Fatal("len result[0] not equal to 1")
}
data, ok := result[0][0].(float64)
if !ok {
t.Fatal("result not float64")
}
if data != float64(num) {
t.Fatal("result not equal to:", num)
}
}(i)
}
waitGroup.Wait()
err = stmt.Close()
if err != nil {
t.Fatal("stmt close error:", err)
}
} | explode_data.jsonl/75729 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 460
} | [
2830,
3393,
3379,
16547,
1155,
353,
8840,
836,
8,
341,
743,
3393,
25479,
5988,
341,
197,
3244,
57776,
7039,
741,
197,
630,
20985,
11,
9121,
1669,
2266,
26124,
7636,
5378,
19047,
1507,
3393,
1972,
7636,
340,
55822,
11,
1848,
1669,
3393,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestHilbert(t *testing.T) {
t.Skip("skipping for gccgo--no importer")
// generate source
src := program(*H, *out)
if *out != "" {
os.WriteFile(*out, src, 0666)
return
}
// parse source
fset := token.NewFileSet()
f, err := parser.ParseFile(fset, "hilbert.go", src, 0)
if err != nil {
t.Fatal(err)
}
// type-check file
DefPredeclaredTestFuncs() // define assert built-in
conf := Config{Importer: importer.Default()}
_, err = conf.Check(f.Name.Name, fset, []*ast.File{f}, nil)
if err != nil {
t.Fatal(err)
}
} | explode_data.jsonl/39826 | {
"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,
39,
321,
9160,
1155,
353,
8840,
836,
8,
341,
3244,
57776,
445,
4886,
5654,
369,
50917,
3346,
313,
2152,
62561,
5130,
197,
322,
6923,
2530,
198,
41144,
1669,
2025,
4071,
39,
11,
353,
411,
340,
743,
353,
411,
961,
1591,
34... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestBuildCodeInSubdir(t *testing.T) {
folder := testlib.Mktmp(t)
subdir := filepath.Join(folder, "bar")
err := os.Mkdir(subdir, 0o755)
require.NoError(t, err)
writeGoodMain(t, subdir)
config := config.Project{
Builds: []config.Build{
{
ID: "foo",
Env: []string{"GO111MODULE=off"},
Dir: "bar",
Binary: "foo",
Targets: []string{
runtimeTarget,
},
GoBinary: "go",
},
},
}
ctx := context.New(config)
ctx.Git.CurrentTag = "5.6.7"
build := ctx.Config.Builds[0]
err = Default.Build(ctx, build, api.Options{
Target: runtimeTarget,
Name: build.Binary,
Path: filepath.Join(folder, "dist", runtimeTarget, build.Binary),
Ext: "",
})
require.NoError(t, err)
} | explode_data.jsonl/54142 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 344
} | [
2830,
3393,
11066,
2078,
641,
3136,
3741,
1155,
353,
8840,
836,
8,
341,
1166,
2018,
1669,
1273,
2740,
1321,
74,
5173,
1155,
340,
28624,
3741,
1669,
26054,
22363,
33929,
11,
330,
2257,
1138,
9859,
1669,
2643,
1321,
12438,
10624,
3741,
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 TestStructureMarshalJSONObject(t *testing.T) {
cases := []struct {
in *Structure
out []byte
err error
}{
{&Structure{Format: "csv"}, []byte(`{"errCount":0,"format":"csv","qri":"st:0"}`), nil},
{&Structure{Format: "csv", Qri: KindStructure.String()}, []byte(`{"errCount":0,"format":"csv","qri":"st:0"}`), nil},
{AirportCodesStructure, []byte(`{"errCount":5,"format":"csv","formatConfig":{"headerRow":true},"qri":"st:0","schema":{"items":{"items":[{"title":"ident","type":"string"},{"title":"type","type":"string"},{"title":"name","type":"string"},{"title":"latitude_deg","type":"string"},{"title":"longitude_deg","type":"string"},{"title":"elevation_ft","type":"string"},{"title":"continent","type":"string"},{"title":"iso_country","type":"string"},{"title":"iso_region","type":"string"},{"title":"municipality","type":"string"},{"title":"gps_code","type":"string"},{"title":"iata_code","type":"string"},{"title":"local_code","type":"string"}],"type":"array"},"type":"array"}}`), nil},
}
for i, c := range cases {
got, err := c.in.MarshalJSONObject()
if err != c.err {
t.Errorf("case %d error mismatch. expected: '%s', got: '%s'", i, c.err, err)
continue
}
// now try to unmarshal to map string interface
check := &map[string]interface{}{}
err = json.Unmarshal(got, check)
if err != nil {
t.Errorf("case %d error: failed to unmarshal to object: %s", i, err.Error())
continue
}
}
} | explode_data.jsonl/16442 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 501
} | [
2830,
3393,
22952,
55438,
23596,
1155,
353,
8840,
836,
8,
341,
1444,
2264,
1669,
3056,
1235,
341,
197,
17430,
220,
353,
22952,
198,
197,
13967,
3056,
3782,
198,
197,
9859,
1465,
198,
197,
59403,
197,
197,
90,
5,
22952,
90,
4061,
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 TestJvString(t *testing.T) {
jv := jq.JvFromString("test")
defer jv.Free()
str, err := jv.String()
if err != nil {
t.Errorf("error when converting jv into string: %s", err)
}
if str != "test" {
t.Errorf(`jvFromString("test") got: %s, want: test`, str)
}
if jv.ToGoVal() != "test" {
t.Errorf(`jvFromString("test").ToGoVal() got: %s, want: test`, jv.ToGoVal())
}
} | explode_data.jsonl/38754 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 174
} | [
2830,
3393,
41,
85,
703,
1155,
353,
8840,
836,
8,
341,
12428,
85,
1669,
44648,
3503,
85,
44491,
445,
1944,
1138,
16867,
502,
85,
52229,
2822,
11355,
11,
1848,
1669,
502,
85,
6431,
741,
743,
1848,
961,
2092,
341,
197,
3244,
13080,
44... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 4 |
func TestGetDestinationServicesFromTrafficTarget(t *testing.T) {
assert := tassert.New(t)
mockCtrl := gomock.NewController(t)
defer mockCtrl.Finish()
mockKubeController := k8s.NewMockController(mockCtrl)
mockEndpointProvider := endpoint.NewMockProvider(mockCtrl)
mc := MeshCatalog{
kubeController: mockKubeController,
endpointsProviders: []endpoint.Provider{mockEndpointProvider},
}
destSA := service.K8sServiceAccount{
Name: "bookstore",
Namespace: "bookstore-ns",
}
destMeshService := service.MeshService{
Name: "bookstore",
Namespace: "bookstore-ns",
}
destK8sService := tests.NewServiceFixture(destMeshService.Name, destMeshService.Namespace, map[string]string{})
mockEndpointProvider.EXPECT().GetServicesForServiceAccount(destSA).Return([]service.MeshService{destMeshService}, nil).AnyTimes()
mockEndpointProvider.EXPECT().GetID().Return("fake").AnyTimes()
mockKubeController.EXPECT().GetService(destMeshService).Return(destK8sService).AnyTimes()
trafficTarget := &access.TrafficTarget{
TypeMeta: v1.TypeMeta{
APIVersion: "access.smi-spec.io/v1alpha3",
Kind: "TrafficTarget",
},
ObjectMeta: v1.ObjectMeta{
Name: "target",
Namespace: "bookstore-ns",
},
Spec: access.TrafficTargetSpec{
Destination: access.IdentityBindingSubject{
Kind: "Name",
Name: "bookstore",
Namespace: "bookstore-ns",
},
Sources: []access.IdentityBindingSubject{{
Kind: "Name",
Name: "bookbuyer",
Namespace: "default",
}},
},
}
actual, err := mc.getDestinationServicesFromTrafficTarget(trafficTarget)
assert.Nil(err)
assert.Equal([]service.MeshService{destMeshService}, actual)
} | explode_data.jsonl/69770 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 654
} | [
2830,
3393,
1949,
33605,
11025,
3830,
87229,
6397,
1155,
353,
8840,
836,
8,
341,
6948,
1669,
259,
2207,
7121,
1155,
340,
77333,
15001,
1669,
342,
316,
1176,
7121,
2051,
1155,
340,
16867,
7860,
15001,
991,
18176,
2822,
77333,
42,
3760,
2... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestVolumeSnapshotCreateAction(t *testing.T) {
var args []string
args = append(args, "bd5b12a8-a101-11e7-941e-d77981b584d8")
volumeSnapshotCreateAction(volumeSnapshotCreateCommand, args)
} | explode_data.jsonl/13553 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 75
} | [
2830,
3393,
18902,
15009,
4021,
2512,
1155,
353,
8840,
836,
8,
341,
2405,
2827,
3056,
917,
198,
31215,
284,
8737,
7356,
11,
330,
8940,
20,
65,
16,
17,
64,
23,
7409,
16,
15,
16,
12,
16,
16,
68,
22,
12,
24,
19,
16,
68,
1737,
22,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestValueAssignmentMalformed(t *testing.T) {
t.Parallel()
data := `{ concat: ["http://", [get_attribute, get_property]: [HOST, public_ip_address], ":", get_property: [SELF, port] ]}`
va := ValueAssignment{}
err := yaml.Unmarshal([]byte(data), &va)
log.Printf("%v", err)
require.Error(t, err)
} | explode_data.jsonl/64269 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 123
} | [
2830,
3393,
1130,
41613,
29600,
10155,
1155,
353,
8840,
836,
8,
341,
3244,
41288,
7957,
741,
8924,
1669,
53692,
33720,
25,
4383,
1254,
1110,
497,
508,
455,
16791,
11,
633,
16638,
5669,
508,
28687,
11,
584,
10385,
6744,
1125,
330,
12147,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestReplaceBool(t *testing.T) {
v := &Value{data: []bool{bool(true), bool(true), bool(true), bool(true), bool(true), bool(true)}}
rawArr := v.MustBoolSlice()
replaced := v.ReplaceBool(func(index int, val bool) bool {
if index < len(rawArr)-1 {
return rawArr[index+1]
}
return rawArr[0]
})
replacedArr := replaced.MustBoolSlice()
if assert.Equal(t, 6, len(replacedArr)) {
assert.Equal(t, replacedArr[0], rawArr[1])
assert.Equal(t, replacedArr[1], rawArr[2])
assert.Equal(t, replacedArr[2], rawArr[3])
assert.Equal(t, replacedArr[3], rawArr[4])
assert.Equal(t, replacedArr[4], rawArr[5])
assert.Equal(t, replacedArr[5], rawArr[0])
}
} | explode_data.jsonl/23406 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 304
} | [
2830,
3393,
23107,
11233,
1155,
353,
8840,
836,
8,
1476,
5195,
1669,
609,
1130,
90,
691,
25,
3056,
2641,
90,
2641,
3715,
701,
1807,
3715,
701,
1807,
3715,
701,
1807,
3715,
701,
1807,
3715,
701,
1807,
3715,
9139,
630,
76559,
8838,
1669... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
func TestTxnCoordSenderCleanupOnAborted(t *testing.T) {
defer leaktest.AfterTest(t)()
defer log.Scope(t).Close(t)
s := createTestDB(t)
defer s.Stop()
ctx := context.Background()
// Create a transaction with intent at "a".
key := roachpb.Key("a")
txn1 := kv.NewTxn(ctx, s.DB, 0 /* gatewayNodeID */)
if err := txn1.Put(ctx, key, []byte("value")); err != nil {
t.Fatal(err)
}
// Push the transaction (by writing key "a" with higher priority) to abort it.
txn2 := kv.NewTxn(ctx, s.DB, 0 /* gatewayNodeID */)
if err := txn2.SetUserPriority(roachpb.MaxUserPriority); err != nil {
t.Fatal(err)
}
if err := txn2.Put(ctx, key, []byte("value2")); err != nil {
t.Fatal(err)
}
// Now end the transaction and verify we've cleanup up, even though
// end transaction failed.
err := txn1.CommitOrCleanup(ctx)
assertTransactionAbortedError(t, err)
if err := txn2.CommitOrCleanup(ctx); err != nil {
t.Fatal(err)
}
verifyCleanup(key, s.Eng, t, txn1.Sender().(*TxnCoordSender), txn2.Sender().(*TxnCoordSender))
} | explode_data.jsonl/76887 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 419
} | [
2830,
3393,
31584,
77,
19437,
20381,
67335,
1925,
5830,
13595,
1155,
353,
8840,
836,
8,
341,
16867,
23352,
1944,
36892,
2271,
1155,
8,
741,
16867,
1487,
77940,
1155,
568,
7925,
1155,
340,
1903,
1669,
1855,
2271,
3506,
1155,
340,
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... | 5 |
func TestConnectionSSL(t *testing.T) {
if testing.Short() {
t.Skip("skipping test in short mode.")
}
ircnick1 := randStr(8)
irccon := IRC(ircnick1, "IRCTestSSL")
debugTest(irccon)
irccon.UseTLS = true
irccon.TLSConfig = &tls.Config{InsecureSkipVerify: true}
irccon.AddCallback("001", func(e *Event) { irccon.Join(channel) })
irccon.AddCallback("366", func(e *Event) {
irccon.Privmsg(channel, "Test Message from SSL\n")
irccon.Quit()
})
err := irccon.Connect(serverssl)
if err != nil {
t.Log(err.Error())
t.Errorf("Can't connect to freenode.")
}
irccon.Loop()
} | explode_data.jsonl/63357 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 249
} | [
2830,
3393,
4526,
22594,
1155,
353,
8840,
836,
8,
341,
743,
7497,
55958,
368,
341,
197,
3244,
57776,
445,
4886,
5654,
1273,
304,
2805,
3856,
13053,
197,
532,
197,
2437,
20406,
16,
1669,
10382,
2580,
7,
23,
340,
197,
2437,
443,
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 TestQueueSmoke(t *testing.T) {
bctx, bcancel := context.WithCancel(context.Background())
defer bcancel()
session, err := mgo.DialWithTimeout("mongodb://localhost:27017", time.Second)
require.NoError(t, err)
defer session.Close()
client, err := mongo.NewClient(options.Client().ApplyURI("mongodb://localhost:27017").SetConnectTimeout(time.Second))
require.NoError(t, err)
require.NoError(t, client.Connect(bctx))
defer func() { require.NoError(t, client.Disconnect(bctx)) }()
for _, test := range DefaultQueueTestCases() {
if test.Skip {
continue
}
t.Run(test.Name, func(t *testing.T) {
for _, driver := range DefaultDriverTestCases(client, session) {
if driver.Skip {
continue
}
if test.IsRemote == driver.SupportsLocal {
continue
}
if test.OrderedSupported && driver.SkipOrdered {
continue
}
t.Run(driver.Name+"Driver", func(t *testing.T) {
for _, runner := range DefaultPoolTestCases() {
if test.IsRemote && runner.SkipRemote {
continue
}
t.Run(runner.Name+"Pool", func(t *testing.T) {
for _, size := range DefaultSizeTestCases() {
if test.MaxSize > 0 && size.Size > test.MaxSize {
continue
}
if runner.MinSize > 0 && runner.MinSize > size.Size {
continue
}
if runner.MaxSize > 0 && runner.MaxSize < size.Size {
continue
}
t.Run(size.Name, func(t *testing.T) {
if !test.SkipUnordered {
t.Run("Unordered", func(t *testing.T) {
UnorderedTest(bctx, t, test, driver, runner, size)
})
}
if test.OrderedSupported && !driver.SkipOrdered {
t.Run("Ordered", func(t *testing.T) {
OrderedTest(bctx, t, test, driver, runner, size)
})
}
if test.WaitUntilSupported || driver.WaitUntilSupported {
t.Run("WaitUntil", func(t *testing.T) {
WaitUntilTest(bctx, t, test, driver, runner, size)
})
}
if test.DispatchBeforeSupported || driver.DispatchBeforeSupported {
t.Run("DispatchBefore", func(t *testing.T) {
DispatchBeforeTest(bctx, t, test, driver, runner, size)
})
}
t.Run("OneExecution", func(t *testing.T) {
OneExecutionTest(bctx, t, test, driver, runner, size)
})
if test.IsRemote && driver.SupportsMulti && !runner.SkipMulti {
for _, multi := range DefaultMultipleExecututionTestCases(driver) {
if multi.MultipleDrivers && size.Name != "Single" {
continue
}
t.Run(multi.Name, func(t *testing.T) {
MultiExecutionTest(bctx, t, test, driver, runner, size, multi)
})
}
if size.Size < 8 {
t.Run("ManyQueues", func(t *testing.T) {
ManyQueueTest(bctx, t, test, driver, runner, size)
})
}
}
})
}
})
}
})
}
})
}
} | explode_data.jsonl/68524 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 1457
} | [
2830,
3393,
7554,
76880,
1155,
353,
8840,
836,
8,
341,
2233,
3773,
11,
17916,
4949,
1669,
2266,
26124,
9269,
5378,
19047,
2398,
16867,
17916,
4949,
2822,
25054,
11,
1848,
1669,
296,
3346,
98462,
2354,
7636,
445,
37197,
1110,
8301,
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... | 1 |
func TestIsAttributeValue(t *testing.T) {
tests := []struct {
in rune
expect bool
}{
{'å', true},
{'A', true},
{'"', false},
{'\'', false},
{'=', false},
{'<', false},
{'>', false},
{'`', false},
}
for _, tt := range tests {
got := isUnquotedAttributeValue(tt.in)
if tt.expect != got {
t.Fatalf("expected %v but %v when in %s", tt.expect, got, string(tt.in))
}
}
} | explode_data.jsonl/80446 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 193
} | [
2830,
3393,
3872,
78554,
1155,
353,
8840,
836,
8,
341,
78216,
1669,
3056,
1235,
341,
197,
17430,
257,
63499,
198,
197,
24952,
1807,
198,
197,
59403,
197,
197,
13608,
3785,
516,
830,
1583,
197,
197,
13608,
32,
516,
830,
1583,
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... | 3 |
func TestAPIPutObjectPartHandlerStreaming(t *testing.T) {
defer DetectTestLeak(t)()
ExecObjectLayerAPITest(t, testAPIPutObjectPartHandlerStreaming, []string{"NewMultipart", "PutObjectPart"})
} | explode_data.jsonl/10709 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 67
} | [
2830,
3393,
7082,
19103,
1190,
5800,
3050,
76509,
1155,
353,
8840,
836,
8,
341,
16867,
33287,
2271,
2304,
585,
1155,
8,
741,
197,
10216,
1190,
9188,
2537,
952,
477,
1155,
11,
1273,
7082,
19103,
1190,
5800,
3050,
76509,
11,
3056,
917,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestMatToImage(t *testing.T) {
mat1 := NewMatWithSize(101, 102, MatTypeCV8UC3)
defer mat1.Close()
img, err := mat1.ToImage()
if err != nil {
t.Errorf("TestToImage %v.", err)
}
if img.Bounds().Dx() != 102 {
t.Errorf("TestToImage incorrect width got %d.", img.Bounds().Dx())
}
if img.Bounds().Dy() != 101 {
t.Errorf("TestToImage incorrect height got %d.", img.Bounds().Dy())
}
mat2 := NewMatWithSize(101, 102, MatTypeCV8UC1)
defer mat2.Close()
img, err = mat2.ToImage()
if err != nil {
t.Errorf("TestToImage %v.", err)
}
mat3 := NewMatWithSize(101, 102, MatTypeCV8UC4)
defer mat3.Close()
img, err = mat3.ToImage()
if err != nil {
t.Errorf("TestToImage %v.", err)
}
matWithUnsupportedType := NewMatWithSize(101, 102, MatTypeCV8S)
defer matWithUnsupportedType.Close()
_, err = matWithUnsupportedType.ToImage()
if err == nil {
t.Error("TestToImage expected error got nil.")
}
} | explode_data.jsonl/81756 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 378
} | [
2830,
3393,
11575,
1249,
1906,
1155,
353,
8840,
836,
8,
341,
59874,
16,
1669,
1532,
11575,
2354,
1695,
7,
16,
15,
16,
11,
220,
16,
15,
17,
11,
6867,
929,
19589,
23,
5459,
18,
340,
16867,
5517,
16,
10421,
2822,
39162,
11,
1848,
166... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 7 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.