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 TestClientsetStoresServiceInstanceClone(t *testing.T) {
clientset := Clientset{&servicecatalogclientset.Clientset{}}
instance := &v1beta1.ServiceInstance{}
instance.Name = "test-instance"
returnedInstance, err := clientset.ServicecatalogV1beta1().ServiceInstances("test-namespace").UpdateStatus(instance)
if err != nil {
t.Fatalf("unexpected error from UpdateStatus: %v", err)
}
actions := clientset.Actions()
if e, a := 1, len(actions); e != a {
t.Fatalf("unexpected number of actions: expected %v, got %v", e, a)
}
action := actions[0]
updateAction, ok := actions[0].(clientgotesting.UpdateAction)
if !ok {
t.Fatalf("unexpected action type; failed to convert action %+v to UpdateAction", action)
}
storedObject := updateAction.GetObject()
storedInstance, ok := storedObject.(*v1beta1.ServiceInstance)
if !ok {
t.Fatalf("unexpected object in action; failed to convert action object %+v to ServiceInstance", storedObject)
}
if e, a := instance, storedInstance; e == a {
t.Fatalf("expected stored instance to not be the same object as original instance: original = %v, stored = %v", e, a)
}
if e, a := returnedInstance, storedInstance; e == a {
t.Fatalf("expected stored instance to not be the same object as returned instance, returned = %v, stored = %v", e, a)
}
if e, a := instance.Name, storedInstance.Name; e != a {
t.Fatalf("unexpected name: expected %v, got %v", e, a)
}
} | explode_data.jsonl/46151 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 476
} | [
2830,
3393,
2959,
746,
69026,
1860,
2523,
37677,
1155,
353,
8840,
836,
8,
341,
25291,
746,
1669,
8423,
746,
90,
5,
7936,
26539,
2972,
746,
11716,
746,
6257,
532,
56256,
1669,
609,
85,
16,
19127,
16,
13860,
2523,
16094,
56256,
2967,
28... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 8 |
func TestReadJSON(t *testing.T) {
f, _ := os.Open(SERVERLOG)
defer f.Close()
var s []map[string]interface{}
json.NewDecoder(f).Decode(&s)
for i := range s {
fmt.Printf("%s %+v\n", s[i]["time"], s[i]["message"])
}
} | explode_data.jsonl/41223 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 107
} | [
2830,
3393,
4418,
5370,
1155,
353,
8840,
836,
8,
341,
1166,
11,
716,
1669,
2643,
12953,
3759,
8417,
7243,
340,
16867,
282,
10421,
2822,
2405,
274,
3056,
2186,
14032,
31344,
16094,
30847,
7121,
20732,
955,
568,
32564,
2099,
82,
692,
2023... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
func TestUpdateHallOfFame(t *testing.T) {
var (
rng = newRand()
testCases = []struct {
hofIn Individuals
indis Individuals
hofOut Individuals
}{
{
hofIn: Individuals{
Individual{Fitness: math.Inf(1)},
},
indis: Individuals{
Individual{Fitness: 0},
},
hofOut: Individuals{
Individual{Fitness: 0},
},
},
{
hofIn: Individuals{
Individual{Fitness: 0},
Individual{Fitness: math.Inf(1)},
},
indis: Individuals{
Individual{Fitness: 1},
},
hofOut: Individuals{
Individual{Fitness: 0},
Individual{Fitness: 1},
},
},
}
)
for i, tc := range testCases {
t.Run(fmt.Sprintf("TC %d", i), func(t *testing.T) {
updateHallOfFame(tc.hofIn, tc.indis, rng)
for i, indi := range tc.hofIn {
if indi.Fitness != tc.hofOut[i].Fitness {
t.Errorf("Expected %v, got %v", tc.hofOut[i], indi)
}
}
})
}
} | explode_data.jsonl/82073 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 459
} | [
2830,
3393,
4289,
71845,
2124,
37,
373,
1155,
353,
8840,
836,
8,
341,
2405,
2399,
197,
7000,
968,
981,
284,
501,
56124,
741,
197,
18185,
37302,
284,
3056,
1235,
341,
298,
9598,
1055,
641,
220,
61425,
198,
298,
197,
484,
285,
220,
61... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestHookRetry(t *testing.T) {
var callCount int
svr := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
callCount++
assert.EqualValues(t, 0, r.ContentLength)
if callCount == 3 {
w.WriteHeader(http.StatusOK)
} else {
w.WriteHeader(http.StatusBadRequest)
}
}))
defer svr.Close()
config := &conf.WebhookConfig{
URL: svr.URL,
Retries: 3,
}
w := Webhook{
WebhookConfig: config,
}
b, err := w.trigger()
defer func() {
if b != nil {
b.Close()
}
}()
require.NoError(t, err)
assert.Equal(t, 3, callCount)
} | explode_data.jsonl/66207 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 261
} | [
2830,
3393,
31679,
51560,
1155,
353,
8840,
836,
8,
341,
2405,
1618,
2507,
526,
198,
1903,
18920,
1669,
54320,
70334,
7121,
5475,
19886,
89164,
18552,
3622,
1758,
37508,
11,
435,
353,
1254,
9659,
8,
341,
197,
67288,
2507,
22940,
197,
694... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestAsyncPatchRequest(t *testing.T) {
t.Log("Sending PATCH async request... (expected http code: 200)")
req := NewRequest()
ch := make(chan *AsyncResponse)
for i := 0; i <= 100; i++ {
req.AsyncPatch("http://httpbin.org/patch", ch)
}
for i := 0; i <= 100; i++ {
aRes := <-ch
if aRes.Err != nil {
t.Error(aRes.Err)
}
if aRes.Resp.GetStatusCode() != 200 {
t.Error(
"For", "PATCH http://httpbin.org/patch",
"expected", 200,
"got", aRes.Resp.GetStatusCode(),
)
}
}
} | explode_data.jsonl/74148 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 226
} | [
2830,
3393,
6525,
43622,
1900,
1155,
353,
8840,
836,
8,
341,
3244,
5247,
445,
49282,
59345,
3312,
1681,
1112,
320,
7325,
1758,
2038,
25,
220,
17,
15,
15,
95377,
24395,
1669,
1532,
1900,
741,
23049,
1669,
1281,
35190,
353,
6525,
2582,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 5 |
func Test_toLog(t *testing.T) {
testCases := []struct {
desc string
fields logrus.Fields
fieldName string
defaultValue string
quoted bool
expectedLog interface{}
}{
{
desc: "Should return int 1",
fields: logrus.Fields{
"Powpow": 1,
},
fieldName: "Powpow",
defaultValue: defaultValue,
quoted: false,
expectedLog: 1,
},
{
desc: "Should return string foo",
fields: logrus.Fields{
"Powpow": "foo",
},
fieldName: "Powpow",
defaultValue: defaultValue,
quoted: true,
expectedLog: `"foo"`,
},
{
desc: "Should return defaultValue if fieldName does not exist",
fields: logrus.Fields{
"Powpow": "foo",
},
fieldName: "",
defaultValue: defaultValue,
quoted: false,
expectedLog: "-",
},
{
desc: "Should return defaultValue if fields is nil",
fields: nil,
fieldName: "",
defaultValue: defaultValue,
quoted: false,
expectedLog: "-",
},
}
for _, test := range testCases {
test := test
t.Run(test.desc, func(t *testing.T) {
t.Parallel()
lg := toLog(test.fields, test.fieldName, defaultValue, test.quoted)
assert.Equal(t, test.expectedLog, lg)
})
}
} | explode_data.jsonl/61895 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 597
} | [
2830,
3393,
2346,
2201,
1155,
353,
8840,
836,
8,
341,
18185,
37302,
1669,
3056,
1235,
341,
197,
41653,
260,
914,
198,
197,
55276,
981,
1487,
20341,
42809,
198,
197,
39250,
675,
262,
914,
198,
197,
11940,
1130,
914,
198,
197,
197,
6372... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestZoneChangesIntegration(t *testing.T) {
c := client()
zones, err := c.ZonesListAll(ListFilter{})
if err != nil {
t.Error(err)
}
changes, err := c.ZoneChanges(zones[0].ID)
if err != nil {
t.Error(err)
}
if changes.ZoneID != zones[0].ID {
t.Error("Expected ZoneChanges to yield correct ID")
}
if len(changes.ZoneChanges) <= 0 {
t.Error("Expected ZoneChanges to yield results")
}
} | explode_data.jsonl/12119 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 160
} | [
2830,
3393,
15363,
11317,
52464,
1155,
353,
8840,
836,
8,
341,
1444,
1669,
2943,
741,
20832,
3154,
11,
1848,
1669,
272,
13476,
3154,
852,
2403,
10278,
5632,
37790,
743,
1848,
961,
2092,
341,
197,
3244,
6141,
3964,
340,
197,
630,
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... | 5 |
func TestKVCompactError(t *testing.T) {
defer testutil.AfterTest(t)
clus := integration.NewClusterV3(t, &integration.ClusterConfig{Size: 1})
defer clus.Terminate(t)
kv := clus.RandClient()
ctx := context.TODO()
for i := 0; i < 5; i++ {
if _, err := kv.Put(ctx, "foo", "bar"); err != nil {
t.Fatalf("couldn't put 'foo' (%v)", err)
}
}
_, err := kv.Compact(ctx, 6)
if err != nil {
t.Fatalf("couldn't compact 6 (%v)", err)
}
_, err = kv.Compact(ctx, 6)
if err != rpctypes.ErrCompacted {
t.Fatalf("expected %v, got %v", rpctypes.ErrCompacted, err)
}
_, err = kv.Compact(ctx, 100)
if err != rpctypes.ErrFutureRev {
t.Fatalf("expected %v, got %v", rpctypes.ErrFutureRev, err)
}
} | explode_data.jsonl/16407 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 323
} | [
2830,
3393,
82707,
98335,
1454,
1155,
353,
8840,
836,
8,
341,
16867,
1273,
1314,
36892,
2271,
1155,
692,
197,
4163,
1669,
17590,
7121,
28678,
53,
18,
1155,
11,
609,
60168,
72883,
2648,
90,
1695,
25,
220,
16,
3518,
16867,
1185,
355,
83... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 6 |
func Test_splitAndCall_Splitting(t *testing.T) {
clientCtx := client.Context{}
addr := sdk.AccAddress(secp256k1.GenPrivKey().PubKey().Address())
// Add five messages
msgs := []sdk.Msg{
sdk.NewTestMsg(addr),
sdk.NewTestMsg(addr),
sdk.NewTestMsg(addr),
sdk.NewTestMsg(addr),
sdk.NewTestMsg(addr),
}
// Keep track of number of calls
const chunkSize = 2
callCount := 0
err := splitAndApply(
func(clientCtx client.Context, msgs []sdk.Msg) error {
callCount++
assert.NotNil(t, clientCtx)
assert.NotNil(t, msgs)
if callCount < 3 {
assert.Equal(t, len(msgs), 2)
} else {
assert.Equal(t, len(msgs), 1)
}
return nil
},
clientCtx, msgs, chunkSize)
assert.NoError(t, err, "")
assert.Equal(t, 3, callCount)
} | explode_data.jsonl/25281 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 335
} | [
2830,
3393,
17052,
3036,
7220,
1098,
2292,
1280,
1155,
353,
8840,
836,
8,
341,
25291,
23684,
1669,
2943,
9328,
31483,
53183,
1669,
45402,
77538,
4286,
10478,
4672,
17,
20,
21,
74,
16,
65384,
32124,
1592,
1005,
29162,
1592,
1005,
4286,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestFactoryDeploy(t *testing.T) {
factoryAddress := common.HexToAddress("0xabcd")
issuerAddress := common.HexToAddress("0xefff")
defaultTimeout := big.NewInt(1)
deployTransactionHash := common.HexToHash("0xffff")
deployAddress := common.HexToAddress("0xdddd")
factory := chequebook.NewFactory(
backendmock.New(),
transactionmock.New(
transactionmock.WithABISend(&factoryABI, deployTransactionHash, factoryAddress, big.NewInt(0), "deploySimpleSwap", issuerAddress, defaultTimeout),
transactionmock.WithWaitForReceiptFunc(func(ctx context.Context, txHash common.Hash) (receipt *types.Receipt, err error) {
if txHash != deployTransactionHash {
t.Fatalf("waiting for wrong transaction. wanted %x, got %x", deployTransactionHash, txHash)
}
logData, err := simpleSwapDeployedEvent.Inputs.NonIndexed().Pack(deployAddress)
if err != nil {
t.Fatal(err)
}
return &types.Receipt{
Status: 1,
Logs: []*types.Log{
{
Data: logData,
},
{
Address: factoryAddress,
Topics: []common.Hash{simpleSwapDeployedEvent.ID},
Data: logData,
},
},
}, nil
},
)),
factoryAddress,
)
txHash, err := factory.Deploy(context.Background(), issuerAddress, defaultTimeout)
if err != nil {
t.Fatal(err)
}
if txHash != deployTransactionHash {
t.Fatalf("returning wrong transaction hash. wanted %x, got %x", deployTransactionHash, txHash)
}
chequebookAddress, err := factory.WaitDeployed(context.Background(), txHash)
if err != nil {
t.Fatal(err)
}
if chequebookAddress != deployAddress {
t.Fatalf("returning wrong address. wanted %x, got %x", deployAddress, chequebookAddress)
}
} | explode_data.jsonl/50292 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 671
} | [
2830,
3393,
4153,
69464,
1155,
353,
8840,
836,
8,
341,
1166,
2919,
4286,
1669,
4185,
91538,
1249,
4286,
445,
15,
52616,
4385,
1138,
197,
66817,
4286,
1669,
4185,
91538,
1249,
4286,
445,
15,
87,
6445,
69,
1138,
11940,
7636,
1669,
2409,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestHandlers_RemoveMessageStamp(t *testing.T) {
t.Parallel()
path := "/api/v3/messages/{messageId}/stamps/{stampId}"
env := Setup(t, common1)
user := env.CreateUser(t, rand)
ch := env.CreateChannel(t, rand)
archived := env.CreateChannel(t, rand)
m := env.CreateMessage(t, user.GetID(), ch.ID, rand)
archivedM := env.CreateMessage(t, user.GetID(), archived.ID, rand)
stamp := env.CreateStamp(t, user.GetID(), rand)
env.AddStampToMessage(t, m.GetID(), stamp.ID, user.GetID())
env.AddStampToMessage(t, archivedM.GetID(), stamp.ID, user.GetID())
require.NoError(t, env.CM.ArchiveChannel(archived.ID, user.GetID()))
s := env.S(t, user.GetID())
t.Run("not logged in", func(t *testing.T) {
t.Parallel()
e := env.R(t)
e.DELETE(path, m.GetID(), stamp.ID).
Expect().
Status(http.StatusUnauthorized)
})
t.Run("message not found", func(t *testing.T) {
t.Parallel()
e := env.R(t)
e.DELETE(path, uuid.Must(uuid.NewV4()), stamp.ID).
WithCookie(session.CookieName, s).
Expect().
Status(http.StatusNotFound)
})
t.Run("stamp not found", func(t *testing.T) {
t.Parallel()
e := env.R(t)
e.DELETE(path, m.GetID(), uuid.Must(uuid.NewV4())).
WithCookie(session.CookieName, s).
Expect().
Status(http.StatusNotFound)
})
t.Run("archived", func(t *testing.T) {
t.Parallel()
e := env.R(t)
e.DELETE(path, archivedM.GetID(), stamp.ID).
WithCookie(session.CookieName, s).
Expect().
Status(http.StatusBadRequest)
})
t.Run("success", func(t *testing.T) {
t.Parallel()
e := env.R(t)
e.DELETE(path, m.GetID(), stamp.ID).
WithCookie(session.CookieName, s).
Expect().
Status(http.StatusNoContent)
m, err := env.MM.Get(m.GetID())
require.NoError(t, err)
assert.Len(t, m.GetStamps(), 0)
})
} | explode_data.jsonl/40158 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 794
} | [
2830,
3393,
39949,
66843,
2052,
20906,
1155,
353,
8840,
836,
8,
341,
3244,
41288,
7957,
2822,
26781,
1669,
3521,
2068,
5457,
18,
71753,
9388,
1994,
764,
4472,
267,
14647,
9388,
49113,
764,
11195,
57538,
1669,
18626,
1155,
11,
4185,
16,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func Test_read(t *testing.T) {
csv := `"Bart Beatty","98","130","158","129","128"
"Marc Murphy","156","93","131","112","118"
"Briana Bauch","108","133","168","121","144"
"Gerda Rosenbaum","109","166","95","159","139"
"Guido Witting","120","123","165","107","135"`
rows, cols := 5, 5
sr := strings.NewReader(csv)
table, err := read(sr, rows, cols)
if err != nil {
t.Errorf("read() error = %v", err)
return
}
err = verifyTableProperties(table, rows, cols)
if err != nil {
t.Error(err)
}
} | explode_data.jsonl/20937 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 206
} | [
2830,
3393,
6443,
1155,
353,
8840,
836,
8,
341,
1444,
3492,
1669,
53305,
33,
471,
2823,
22908,
2198,
24,
23,
2198,
16,
18,
15,
2198,
16,
20,
23,
2198,
16,
17,
24,
2198,
16,
17,
23,
698,
1,
47641,
29953,
2198,
16,
20,
21,
2198,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
func Test_parseStatusFlag(t *testing.T) {
tests := []struct {
name string
status string
want v1.LoadBalancerStatus
}{
{
name: "IPv4",
status: "10.0.0.1",
want: v1.LoadBalancerStatus{
Ingress: []v1.LoadBalancerIngress{
{
IP: "10.0.0.1",
},
},
},
},
{
name: "IPv6",
status: "2001:4860:4860::8888",
want: v1.LoadBalancerStatus{
Ingress: []v1.LoadBalancerIngress{
{
IP: "2001:4860:4860::8888",
},
},
},
},
{
name: "arbitrary string",
status: "anarbitrarystring",
want: v1.LoadBalancerStatus{
Ingress: []v1.LoadBalancerIngress{
{
Hostname: "anarbitrarystring",
},
},
},
},
{
name: "WhitespacePadded",
status: " anarbitrarystring ",
want: v1.LoadBalancerStatus{
Ingress: []v1.LoadBalancerIngress{
{
Hostname: "anarbitrarystring",
},
},
},
},
{
name: "Empty",
status: "",
want: v1.LoadBalancerStatus{
Ingress: []v1.LoadBalancerIngress{},
},
},
{
name: "EmptyComma",
status: ",",
want: v1.LoadBalancerStatus{
Ingress: []v1.LoadBalancerIngress{},
},
},
{
name: "EmptySpace",
status: " ",
want: v1.LoadBalancerStatus{
Ingress: []v1.LoadBalancerIngress{},
},
},
{
name: "SingleComma",
status: "10.0.0.1,",
want: v1.LoadBalancerStatus{
Ingress: []v1.LoadBalancerIngress{
{
IP: "10.0.0.1",
},
},
},
},
{
name: "SingleCommaBefore",
status: ",10.0.0.1",
want: v1.LoadBalancerStatus{
Ingress: []v1.LoadBalancerIngress{
{
IP: "10.0.0.1",
},
},
},
},
{
name: "Multi",
status: "10.0.0.1,2001:4860:4860::8888,anarbitrarystring",
want: v1.LoadBalancerStatus{
Ingress: []v1.LoadBalancerIngress{
{
IP: "10.0.0.1",
},
{
IP: "2001:4860:4860::8888",
},
{
Hostname: "anarbitrarystring",
},
},
},
},
{
name: "MultiSpace",
status: "10.0.0.1, 2001:4860:4860::8888, anarbitrarystring",
want: v1.LoadBalancerStatus{
Ingress: []v1.LoadBalancerIngress{
{
IP: "10.0.0.1",
},
{
IP: "2001:4860:4860::8888",
},
{
Hostname: "anarbitrarystring",
},
},
},
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
if diff := cmp.Diff(parseStatusFlag(tt.status), tt.want); diff != "" {
t.Errorf("parseStatusFlag failed: %s", diff)
}
})
}
} | explode_data.jsonl/50892 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 1410
} | [
2830,
3393,
21039,
2522,
12135,
1155,
353,
8840,
836,
8,
341,
78216,
1669,
3056,
1235,
341,
197,
11609,
256,
914,
198,
197,
23847,
914,
198,
197,
50780,
256,
348,
16,
13969,
93825,
2522,
198,
197,
59403,
197,
197,
515,
298,
11609,
25,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
func Test_hardwareCmd(t *testing.T) {
subCommand := "hardware"
type args struct {
name string
}
tests := []struct {
name string
args args
want *cobra.Command
cmdFunc func(*testing.T, *cobra.Command)
}{
{
name: "NoArgs",
args: args{name: testCommand},
want: &cobra.Command{},
cmdFunc: func(t *testing.T, c *cobra.Command) {
root := c.Root()
root.SetArgs([]string{subCommand})
if err := root.Execute(); err != nil {
t.Logf("%+v", root.Args)
t.Error("expected an error")
}
},
},
{
name: "ID",
args: args{name: testCommand},
want: &cobra.Command{},
cmdFunc: func(t *testing.T, c *cobra.Command) {
root := c.Root()
out := &bytes.Buffer{}
root.SetArgs([]string{subCommand, "id", "-h"})
root.SetOutput(out)
if err := root.Execute(); err != nil {
t.Error(err)
}
if !strings.Contains(out.String(), "get hardware by id") {
t.Error("expected output should include get hardware by id")
}
},
},
{
name: "List",
args: args{name: testCommand},
want: &cobra.Command{},
cmdFunc: func(t *testing.T, c *cobra.Command) {
root := c.Root()
out := &bytes.Buffer{}
root.SetArgs([]string{subCommand, "list", "-h"})
root.SetOutput(out)
if err := root.Execute(); err != nil {
t.Error(err)
}
if !strings.Contains(out.String(), "list all known hardware") {
t.Error("expected output should include list all known hardware")
}
},
},
{
name: "IP",
args: args{name: testCommand},
want: &cobra.Command{},
cmdFunc: func(t *testing.T, c *cobra.Command) {
root := c.Root()
out := &bytes.Buffer{}
root.SetArgs([]string{subCommand, "ip", "-h"})
root.SetOutput(out)
if err := root.Execute(); err != nil {
t.Error(err)
}
if !strings.Contains(out.String(), "get hardware by any associated ip") {
t.Error("expected output should include get hardware by any associated ip")
}
},
},
{
name: "MAC",
args: args{name: testCommand},
want: &cobra.Command{},
cmdFunc: func(t *testing.T, c *cobra.Command) {
root := c.Root()
out := &bytes.Buffer{}
root.SetArgs([]string{subCommand, "mac", "-h"})
root.SetOutput(out)
if err := root.Execute(); err != nil {
t.Error(err)
}
if !strings.Contains(out.String(), "get hardware by any associated mac") {
t.Error("expected output should include get hardware by any associated mac")
}
},
},
{
name: "Delete",
args: args{name: testCommand},
want: &cobra.Command{},
cmdFunc: func(t *testing.T, c *cobra.Command) {
root := c.Root()
out := &bytes.Buffer{}
root.SetArgs([]string{subCommand, "delete", "-h"})
root.SetOutput(out)
if err := root.Execute(); err != nil {
t.Error(err)
}
if !strings.Contains(out.String(), "delete hardware by id") {
t.Error("expected output should include delete hardware by id")
}
},
},
{
name: "Watch",
args: args{name: testCommand},
want: &cobra.Command{},
cmdFunc: func(t *testing.T, c *cobra.Command) {
root := c.Root()
out := &bytes.Buffer{}
root.SetArgs([]string{subCommand, "watch", "-h"})
root.SetOutput(out)
if err := root.Execute(); err != nil {
t.Error(err)
}
if !strings.Contains(out.String(), "register to watch an id for any changes") {
t.Error("expected output should include register to watch an id for any changes")
}
},
},
{
name: "Push",
args: args{name: testCommand},
want: &cobra.Command{},
cmdFunc: func(t *testing.T, c *cobra.Command) {
root := c.Root()
out := &bytes.Buffer{}
root.SetArgs([]string{subCommand, "push", "-h"})
root.SetOutput(out)
if err := root.Execute(); err != nil {
t.Error(err)
}
if !strings.Contains(out.String(), "push new hardware to tink") {
t.Error("expected output should include push new hardware to tink")
}
},
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
rootCmd := &cobra.Command{
Use: testCommand,
Run: func(_ *cobra.Command, _ []string) {},
Version: "test",
}
rootCmd.AddCommand(hardwareCmd)
tt.cmdFunc(t, rootCmd)
})
}
} | explode_data.jsonl/29301 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 1924
} | [
2830,
3393,
1523,
37750,
15613,
1155,
353,
8840,
836,
8,
341,
28624,
4062,
1669,
330,
68215,
698,
13158,
2827,
2036,
341,
197,
11609,
914,
198,
197,
532,
78216,
1669,
3056,
1235,
341,
197,
11609,
262,
914,
198,
197,
31215,
262,
2827,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestUSymbolPriceTicker(t *testing.T) {
t.Parallel()
_, err := b.USymbolPriceTicker(context.Background(), currency.NewPair(currency.BTC, currency.USDT))
if err != nil {
t.Error(err)
}
_, err = b.USymbolPriceTicker(context.Background(), currency.EMPTYPAIR)
if err != nil {
t.Error(err)
}
} | explode_data.jsonl/76560 | {
"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,
2034,
4001,
6972,
87278,
1155,
353,
8840,
836,
8,
341,
3244,
41288,
7957,
741,
197,
6878,
1848,
1669,
293,
67672,
4001,
6972,
87278,
5378,
19047,
1507,
11413,
7121,
12443,
90475,
1785,
7749,
11,
11413,
67672,
10599,
1171,
743,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
func TestHTMLKeepEndTags(t *testing.T) {
htmlTests := []struct {
html string
expected string
}{
{`<p></p><p></p>`, `<p></p><p></p>`},
{`<ul><li></li><li></li></ul>`, `<ul><li></li><li></li></ul>`},
}
m := minify.New()
htmlMinifier := &Minifier{KeepEndTags: true}
for _, tt := range htmlTests {
t.Run(tt.html, func(t *testing.T) {
r := bytes.NewBufferString(tt.html)
w := &bytes.Buffer{}
err := htmlMinifier.Minify(m, w, r, nil)
test.Minify(t, tt.html, err, w.String(), tt.expected)
})
}
} | explode_data.jsonl/59583 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 248
} | [
2830,
3393,
5835,
19434,
3727,
15930,
1155,
353,
8840,
836,
8,
341,
36126,
18200,
1669,
3056,
1235,
341,
197,
36126,
257,
914,
198,
197,
42400,
914,
198,
197,
59403,
197,
197,
90,
63,
27,
79,
1472,
79,
1784,
79,
1472,
79,
29,
7808,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestCacheIndexFuncReturnsDifferentResultsForDifferentInputs(t *testing.T) {
type orgRepoBranch struct{ org, repo, branch string }
results := sets.String{}
inputs := []orgRepoBranch{
{"org-a", "repo-a", "branch-a"},
{"org-a", "repo-a", "branch-b"},
{"org-a", "repo-b", "branch-a"},
{"org-b", "repo-a", "branch-a"},
}
for _, input := range inputs {
pj := getProwJob(prowapi.PresubmitJob, input.org, input.repo, input.branch, "123", "", nil)
idx := cacheIndexFunc(pj)
if n := len(idx); n != 1 {
t.Fatalf("expected to get exactly one index back, got %d", n)
}
if results.Has(idx[0]) {
t.Errorf("got duplicate idx %q", idx)
}
results.Insert(idx[0])
}
} | explode_data.jsonl/42796 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 303
} | [
2830,
3393,
8233,
1552,
9626,
16446,
69123,
9801,
2461,
69123,
31946,
1155,
353,
8840,
836,
8,
341,
13158,
1240,
25243,
18197,
2036,
90,
1240,
11,
15867,
11,
8870,
914,
555,
55497,
1669,
7289,
6431,
16094,
22427,
82,
1669,
3056,
1775,
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 Test_UnsafeSetIsSubset(t *testing.T) {
a := makeUnsafeSet([]int{1, 2, 3, 5, 7})
b := NewThreadUnsafeSet()
b.Add(3)
b.Add(5)
b.Add(7)
if !b.IsSubset(a) {
t.Error("set b should be a subset of set a")
}
b.Add(72)
if b.IsSubset(a) {
t.Error("set b should not be a subset of set a because it contains 72 which is not in the set of a")
}
} | explode_data.jsonl/184 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 161
} | [
2830,
3393,
40687,
18675,
1649,
3872,
70584,
1155,
353,
8840,
836,
8,
341,
11323,
1669,
1281,
78770,
1649,
10556,
396,
90,
16,
11,
220,
17,
11,
220,
18,
11,
220,
20,
11,
220,
22,
8824,
2233,
1669,
1532,
6855,
78770,
1649,
741,
2233,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestStream_writeArray(t *testing.T) {
t.Run("test write failed", func(t *testing.T) {
assert := base.NewAssert(t)
testRange := getTestRange(streamPosBody, 3*streamBlockSize, 80, 80, 61)
for _, testData := range streamTestWriteCollections["array"] {
for _, i := range testRange {
stream := NewStream()
stream.SetWritePos(i)
assert(stream.writeArray(testData[0].(Array), 64)).
Equals(testData[1])
if testData[1].(string) != StreamWriteOK {
assert(stream.GetWritePos()).Equals(i)
}
stream.Release()
}
}
})
t.Run("test write ok", func(t *testing.T) {
assert := base.NewAssert(t)
testRange := getTestRange(streamPosBody, 3*streamBlockSize, 80, 80, 61)
for _, testData := range streamTestSuccessCollections["array"] {
for _, i := range testRange {
stream := NewStream()
stream.SetWritePos(i)
assert(stream.writeArray(testData[0].(Array), 64)).
Equals(StreamWriteOK)
assert(stream.GetBuffer()[i:]).Equals(testData[1])
assert(stream.GetWritePos()).
Equals(len(testData[1].([]byte)) + i)
stream.Release()
}
}
})
} | explode_data.jsonl/21211 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 461
} | [
2830,
3393,
3027,
9165,
1857,
1155,
353,
8840,
836,
8,
341,
3244,
16708,
445,
1944,
3270,
4641,
497,
2915,
1155,
353,
8840,
836,
8,
341,
197,
6948,
1669,
2331,
7121,
8534,
1155,
340,
197,
18185,
6046,
1669,
633,
2271,
6046,
20574,
485... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestACRBasicExample(t *testing.T) {
t.Parallel()
// Create values for Terraform
//subscriptionID := "" // subscriptionID is overridden by the environment variable "ARM_SUBSCRIPTION_ID"
// Configure Terraform setting up a path to Terraform code.
terraformOptions := &terraform.Options{
// Relative path to the Terraform dir
TerraformDir: "../examples/basic",
}
// At the end of the test, run `terraform destroy` to clean up any resources that were created
defer terraform.Destroy(t, terraformOptions)
// Run `terraform init` and `terraform apply`. Fail the test if there are any errors
terraform.InitAndApply(t, terraformOptions)
} | explode_data.jsonl/61189 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 201
} | [
2830,
3393,
1706,
49,
15944,
13314,
1155,
353,
8840,
836,
8,
341,
3244,
41288,
7957,
2822,
197,
322,
4230,
2750,
369,
49426,
627,
198,
197,
322,
34404,
915,
1669,
1591,
442,
15142,
915,
374,
51456,
553,
279,
4573,
3890,
330,
17911,
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 TestCheckedTypeAssertions(t *testing.T) {
tests := []struct {
name string
typeName string
}{
{"assert", "TestAssert"},
{"apply", "TestStep"},
}
for _, test := range tests {
t.Run(test.name, func(t *testing.T) {
step := Step{}
path := fmt.Sprintf("step_integration_test_data/00-%s.yaml", test.name)
assert.EqualError(t, step.LoadYAML(path),
fmt.Sprintf("failed to load %s object from %s: it contains an object of type *unstructured.Unstructured",
test.typeName, path))
})
}
} | explode_data.jsonl/43660 | {
"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,
12666,
929,
90206,
1155,
353,
8840,
836,
8,
341,
78216,
1669,
3056,
1235,
341,
197,
11609,
257,
914,
198,
197,
13158,
675,
914,
198,
197,
59403,
197,
197,
4913,
2207,
497,
330,
2271,
8534,
7115,
197,
197,
4913,
10280,
497,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestDeploymentHash(t *testing.T) {
three := int32(3)
testCases := []struct {
description string
mutate func(*appsv1.Deployment)
expectDeploymentHashChanged bool
expectTemplateHashChanged bool
}{
{
description: "if nothing changes",
mutate: func(_ *appsv1.Deployment) {},
},
{
description: "if .uid changes",
mutate: func(deployment *appsv1.Deployment) {
deployment.UID = "2"
},
},
{
description: "if .name changes",
mutate: func(deployment *appsv1.Deployment) {
deployment.Name = "foo"
},
expectDeploymentHashChanged: true,
expectTemplateHashChanged: true,
},
{
description: "if .spec.replicas changes",
mutate: func(deployment *appsv1.Deployment) {
deployment.Spec.Replicas = &three
},
expectDeploymentHashChanged: true,
},
{
description: "if .spec.template.spec.tolerations change",
mutate: func(deployment *appsv1.Deployment) {
deployment.Spec.Template.Spec.Tolerations = []corev1.Toleration{toleration}
},
expectDeploymentHashChanged: true,
expectTemplateHashChanged: true,
},
}
for _, tc := range testCases {
two := int32(2)
original := &appsv1.Deployment{
ObjectMeta: metav1.ObjectMeta{
Name: "router-original",
Namespace: "openshift-ingress",
UID: "1",
},
Spec: appsv1.DeploymentSpec{
Template: corev1.PodTemplateSpec{
Spec: corev1.PodSpec{
Tolerations: []corev1.Toleration{toleration, otherToleration},
},
},
Replicas: &two,
},
}
mutated := original.DeepCopy()
tc.mutate(mutated)
deploymentHashChanged := deploymentHash(original) != deploymentHash(mutated)
templateHashChanged := deploymentTemplateHash(original) != deploymentTemplateHash(mutated)
if templateHashChanged && !deploymentHashChanged {
t.Errorf("%q: deployment hash changed but the template hash did not", tc.description)
}
if deploymentHashChanged != tc.expectDeploymentHashChanged {
t.Errorf("%q: expected deployment hash changed to be %t, got %t", tc.description, tc.expectDeploymentHashChanged, deploymentHashChanged)
}
if templateHashChanged != tc.expectTemplateHashChanged {
t.Errorf("%q: expected template hash changed to be %t, got %t", tc.description, tc.expectTemplateHashChanged, templateHashChanged)
}
}
} | explode_data.jsonl/46506 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 942
} | [
2830,
3393,
75286,
6370,
1155,
353,
8840,
836,
8,
341,
197,
27856,
1669,
526,
18,
17,
7,
18,
340,
18185,
37302,
1669,
3056,
1235,
341,
197,
42407,
338,
914,
198,
197,
2109,
332,
349,
2549,
2915,
4071,
676,
3492,
16,
34848,
39130,
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... | 1 |
func TestDb_RecoverWithEmptyJournal(t *testing.T) {
trun(t, func(h *dbHarness) {
h.put("foo", "v1")
h.put("foo", "v2")
h.reopenDB()
h.reopenDB()
h.put("foo", "v3")
h.reopenDB()
h.getVal("foo", "v3")
})
} | explode_data.jsonl/6015 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 118
} | [
2830,
3393,
7994,
50693,
3688,
2354,
3522,
43494,
1155,
353,
8840,
836,
8,
341,
25583,
359,
1155,
11,
2915,
3203,
353,
1999,
74248,
8,
341,
197,
9598,
3597,
445,
7975,
497,
330,
85,
16,
1138,
197,
9598,
3597,
445,
7975,
497,
330,
85... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestLint(t *testing.T) {
_, o := lint.NewCmdPipelineLint()
o.Dir = "test_data"
err := o.Run()
require.NoError(t, err, "Failed to run linter")
require.Len(t, o.Tests, 2, "resulting tests")
for i := 0; i < 2; i++ {
tr := o.Tests[i]
require.NotNil(t, tr, "test result for %d", i)
require.Nil(t, tr.Error, "error for test %d", i)
}
} | explode_data.jsonl/73769 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 163
} | [
2830,
3393,
47556,
1155,
353,
8840,
836,
8,
341,
197,
6878,
297,
1669,
57920,
7121,
15613,
34656,
47556,
2822,
22229,
83757,
284,
330,
1944,
1769,
698,
9859,
1669,
297,
16708,
741,
17957,
35699,
1155,
11,
1848,
11,
330,
9408,
311,
1598,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestContainerStopSignal(t *testing.T) {
c := &Container{
Config: &container.Config{},
}
def, err := signal.ParseSignal(defaultStopSignal)
if err != nil {
t.Fatal(err)
}
s := c.StopSignal()
if s != int(def) {
t.Fatalf("Expected %v, got %v", def, s)
}
c = &Container{
Config: &container.Config{StopSignal: "SIGKILL"},
}
s = c.StopSignal()
if s != 9 {
t.Fatalf("Expected 9, got %v", s)
}
} | explode_data.jsonl/72824 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 187
} | [
2830,
3393,
4502,
10674,
26810,
1155,
353,
8840,
836,
8,
341,
1444,
1669,
609,
4502,
515,
197,
66156,
25,
609,
3586,
10753,
38837,
197,
630,
7452,
11,
1848,
1669,
8286,
8937,
26810,
18978,
10674,
26810,
340,
743,
1848,
961,
2092,
341,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 4 |
func TestStartAndStop(t *testing.T) {
go Start(nil)
time.Sleep(time.Second * 2)
if sdErr := ShutDown(); sdErr != nil {
t.Errorf(sdErr.Error())
}
} | explode_data.jsonl/20475 | {
"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,
3479,
3036,
10674,
1155,
353,
8840,
836,
8,
341,
30680,
5145,
27907,
340,
21957,
31586,
9730,
32435,
353,
220,
17,
340,
743,
20585,
7747,
1669,
48274,
4454,
2129,
20585,
7747,
961,
2092,
341,
197,
3244,
13080,
50600,
7747,
6... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 2 |
func TestString(t *testing.T) {
table := []struct {
input *RBNode
expect string
}{
{&RBNode{}, "B:0(,)"},
{&RBNode{
10, false,
&RBNode{5, true, nil, nil},
&RBNode{
20, true,
&RBNode{17, false, nil, nil},
&RBNode{25, false, nil, nil},
},
}, "B:10(R:5(,),R:20(B:17(,),B:25(,)))"},
}
for _, te := range table {
if te.input.String() != te.expect {
t.Errorf("String() => %q, want %q", te.input.String(), te.expect)
}
}
} | explode_data.jsonl/9581 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 248
} | [
2830,
3393,
703,
1155,
353,
8840,
836,
8,
341,
26481,
1669,
3056,
1235,
341,
197,
22427,
220,
353,
29259,
1955,
198,
197,
24952,
914,
198,
197,
59403,
197,
197,
90,
5,
29259,
1955,
22655,
330,
33,
25,
15,
7,
46021,
7115,
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 TestMonthly(t *testing.T) {
for i := 1; i <= 28; i++ {
re := parseRe(fmt.Sprintf("[] bla (every %d.)", i))
assert.NotNil(t, re)
assert.Equal(t, moment.RecurMonthly, re.Recurrence)
assert.Equal(t, i, re.RefDate.Time.Day())
}
} | explode_data.jsonl/67515 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 112
} | [
2830,
3393,
72007,
1155,
353,
8840,
836,
8,
341,
2023,
600,
1669,
220,
16,
26,
600,
2651,
220,
17,
23,
26,
600,
1027,
341,
197,
17200,
1669,
4715,
693,
28197,
17305,
445,
1294,
84541,
320,
29015,
1018,
67,
6138,
497,
600,
1171,
197,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
func Test_dbGroup_InsertAutoDetail(t *testing.T) {
dataSet := dbtool.GenerateDataSet(10000)
c1 := dbGroup{
ShardNodes: []ShardConn{&fakeShardConn{true}, &fakeShardConn{true}, &fakeShardConn{true}},
opt: option{RetryNum: 3, GroupInsertLimiter: rate.NewLimiter(rate.Inf, 0)},
}
errDetail1, err := c1.InsertAutoDetail(``, "pk", dataSet)
if err != nil {
t.Fatal(err)
}
for i, item := range errDetail1 {
if i+1 != item.ShardIndex {
t.Fatal("shard index error")
}
fmt.Println(item.ShardIndex)
fmt.Println(item.Err)
fmt.Println(len(item.Datas.([]*dbtool.DataInstance)))
}
c2 := dbGroup{
ShardNodes: []ShardConn{&fakeShardConn{false}, &fakeShardConn{false}, &fakeShardConn{false}},
opt: option{RetryNum: 3, GroupInsertLimiter: rate.NewLimiter(rate.Inf, 0)},
}
errDetail2, err := c2.InsertAutoDetail(``, "pk", dataSet)
if err != nil {
t.Fatal(err)
}
if len(errDetail2) != 0 {
t.Fatal("count not 0")
}
c3 := dbGroup{
ShardNodes: []ShardConn{&fakeShardConn{false}, &fakeShardConn{true}, &fakeShardConn{false}},
opt: option{RetryNum: 3, GroupInsertLimiter: rate.NewLimiter(rate.Inf, 0)},
}
errDetail3, err := c3.InsertAutoDetail(``, "pk", dataSet)
if err != nil {
t.Fatal(err)
}
if errDetail3[0].ShardIndex != 2 {
t.Fatal("shard index not 2")
}
fmt.Println(errDetail3[0].ShardIndex)
fmt.Println(errDetail3[0].Err)
fmt.Println(len(errDetail3[0].Datas.([]*dbtool.DataInstance)))
} | explode_data.jsonl/78673 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 662
} | [
2830,
3393,
8685,
2808,
76417,
13253,
10649,
1155,
353,
8840,
836,
8,
341,
8924,
1649,
1669,
2927,
14172,
57582,
21577,
7,
16,
15,
15,
15,
15,
692,
1444,
16,
1669,
2927,
2808,
515,
197,
197,
2016,
567,
12288,
25,
3056,
2016,
567,
97... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 8 |
func TestMaxEvidenceBytes(t *testing.T) {
val := NewMockPV()
blockID := makeBlockID(tmhash.Sum([]byte("blockhash")), math.MaxInt64, tmhash.Sum([]byte("partshash")))
blockID2 := makeBlockID(tmhash.Sum([]byte("blockhash2")), math.MaxInt64, tmhash.Sum([]byte("partshash")))
const chainID = "mychain"
ev := &DuplicateVoteEvidence{
PubKey: secp256k1.GenPrivKey().PubKey(), // use secp because it's pubkey is longer
VoteA: makeVote(val, chainID, math.MaxInt64, math.MaxInt64, math.MaxInt64, math.MaxInt64, blockID),
VoteB: makeVote(val, chainID, math.MaxInt64, math.MaxInt64, math.MaxInt64, math.MaxInt64, blockID2),
}
bz, err := cdc.MarshalBinaryLengthPrefixed(ev)
require.NoError(t, err)
assert.EqualValues(t, MaxEvidenceBytes, len(bz))
} | explode_data.jsonl/80948 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 298
} | [
2830,
3393,
5974,
92602,
7078,
1155,
353,
8840,
836,
8,
341,
19302,
1669,
1532,
11571,
48469,
741,
47996,
915,
1669,
1281,
4713,
915,
64190,
8296,
41676,
10556,
3782,
445,
4574,
8296,
35674,
6888,
14535,
1072,
21,
19,
11,
17333,
8296,
4... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func Test_Successful_Execution_Works_With_SafeRelease(t *testing.T) {
// Should end in Alert Bad Thing Happened State
release := models.MockRelease(t)
release.SafeRelease = true
assertSuccessfulExecution(t, release)
} | explode_data.jsonl/3576 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 69
} | [
2830,
3393,
87161,
1262,
62,
20294,
2763,
73302,
62,
2354,
1098,
5645,
16077,
1155,
353,
8840,
836,
8,
341,
197,
322,
12260,
835,
304,
13975,
11461,
37200,
34700,
6758,
3234,
198,
17200,
1623,
1669,
4119,
24664,
16077,
1155,
340,
17200,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestNetworkUnavailableNodeDaemonLaunchesPod(t *testing.T) {
for _, strategy := range updateStrategies() {
ds := newDaemonSet("simple")
ds.Spec.UpdateStrategy = *strategy
manager, podControl, _, err := newTestController(ds)
if err != nil {
t.Fatalf("error creating DaemonSets controller: %v", err)
}
node := newNode("network-unavailable", nil)
node.Status.Conditions = []v1.NodeCondition{
{Type: v1.NodeNetworkUnavailable, Status: v1.ConditionTrue},
}
manager.nodeStore.Add(node)
manager.dsStore.Add(ds)
syncAndValidateDaemonSets(t, manager, ds, podControl, 1, 0, 0)
}
} | explode_data.jsonl/50315 | {
"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,
12320,
92928,
1955,
89177,
32067,
288,
23527,
1155,
353,
8840,
836,
8,
341,
2023,
8358,
8282,
1669,
2088,
2647,
2580,
69388,
368,
341,
197,
83336,
1669,
501,
89177,
1649,
445,
22944,
1138,
197,
83336,
36473,
16689,
19816,
284,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestOpenReportIdempotent(t *testing.T) {
if testing.Short() {
t.Skip("skip test in short mode")
}
sess := newSessionForTesting(t)
defer sess.Close()
builder, err := sess.NewExperimentBuilder("example")
if err != nil {
t.Fatal(err)
}
exp := builder.NewExperiment()
if exp.ReportID() != "" {
t.Fatal("unexpected initial report ID")
}
if err := exp.SubmitAndUpdateMeasurement(&model.Measurement{}); err == nil {
t.Fatal("we should not be able to submit before OpenReport")
}
err = exp.OpenReport()
if err != nil {
t.Fatal(err)
}
rid := exp.ReportID()
if rid == "" {
t.Fatal("invalid report ID")
}
err = exp.OpenReport()
if err != nil {
t.Fatal(err)
}
if rid != exp.ReportID() {
t.Fatal("OpenReport is not idempotent")
}
} | explode_data.jsonl/26321 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 303
} | [
2830,
3393,
5002,
10361,
764,
3262,
63532,
1155,
353,
8840,
836,
8,
341,
743,
7497,
55958,
368,
341,
197,
3244,
57776,
445,
20599,
1273,
304,
2805,
3856,
1138,
197,
532,
1903,
433,
1669,
501,
5283,
2461,
16451,
1155,
340,
16867,
21875,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestApplyNodeAffinityLabelsDoesSucceed(t *testing.T) {
affinityTrait, environment, deployment := createNominalAffinityTest()
affinityTrait.NodeAffinityLabels = []string{"criteria = value"}
err := affinityTrait.Apply(environment)
assert.Nil(t, err)
assert.NotNil(t, deployment.Spec.Template.Spec.Affinity.NodeAffinity)
nodeAffinity := deployment.Spec.Template.Spec.Affinity.NodeAffinity
assert.NotNil(t, nodeAffinity.RequiredDuringSchedulingIgnoredDuringExecution.NodeSelectorTerms[0].MatchExpressions[0])
nodeSelectorRequirement := nodeAffinity.RequiredDuringSchedulingIgnoredDuringExecution.NodeSelectorTerms[0].MatchExpressions[0]
assert.Equal(t, "criteria", nodeSelectorRequirement.Key)
assert.Equal(t, corev1.NodeSelectorOpIn, nodeSelectorRequirement.Operator)
assert.ElementsMatch(t, [1]string{"value"}, nodeSelectorRequirement.Values)
} | explode_data.jsonl/10354 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 280
} | [
2830,
3393,
28497,
1955,
25841,
13489,
23674,
21468,
50,
29264,
1155,
353,
8840,
836,
8,
341,
197,
2649,
13489,
49257,
11,
4573,
11,
23172,
1669,
1855,
36312,
977,
25841,
13489,
2271,
741,
197,
2649,
13489,
49257,
21714,
25841,
13489,
236... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestCreateExecutorOutputFiles(t *testing.T) {
Convey("I should be able to create files and folders for experiment details", t, func() {
outputDir, err := createOutputDirectory("command", "test")
So(err, ShouldBeNil)
stdout, stderr, err := createExecutorOutputFiles(outputDir)
So(err, ShouldBeNil)
So(stdout, ShouldNotBeNil)
So(stderr, ShouldNotBeNil)
defer filesCleanup(stdout, stderr)
Convey("Which should have got valid modes.", func() {
eStat, err := stderr.Stat()
So(err, ShouldBeNil)
So(eStat.Mode().String(), ShouldEqual, expectedFileMode)
oStat, err := stdout.Stat()
So(err, ShouldBeNil)
So(oStat.Mode().String(), ShouldEqual, expectedFileMode)
parentDir := path.Dir(stdout.Name())
pDirStat, err := os.Stat(parentDir)
So(err, ShouldBeNil)
So(pDirStat.Mode().String(), ShouldEqual, expectedDirMode)
})
})
} | explode_data.jsonl/44881 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 335
} | [
2830,
3393,
4021,
25255,
5097,
10809,
1155,
353,
8840,
836,
8,
341,
93070,
5617,
445,
40,
1265,
387,
2952,
311,
1855,
3542,
323,
29242,
369,
9342,
3565,
497,
259,
11,
2915,
368,
341,
197,
21170,
6184,
11,
1848,
1669,
1855,
5097,
9310,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestCurrentVersion(t *testing.T) {
ctx, keeper := createTestInput(t)
require.Equal(t, keeper.GetCurrentVersion(ctx), uint64(0))
require.NotPanics(t, func() { keeper.SetCurrentVersion(ctx, 1) })
require.Equal(t, keeper.GetCurrentVersion(ctx), uint64(1))
} | explode_data.jsonl/74387 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 94
} | [
2830,
3393,
5405,
5637,
1155,
353,
8840,
836,
8,
341,
20985,
11,
53416,
1669,
1855,
2271,
2505,
1155,
692,
17957,
12808,
1155,
11,
53416,
44242,
5637,
7502,
701,
2622,
21,
19,
7,
15,
4390,
17957,
15000,
35693,
1211,
1155,
11,
2915,
36... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestJoinChannelConfig(t *testing.T) {
// Scenarios: The channel we're joining has a single org - Org0
// but our org ID is actually Org0MSP in the negative path
// and Org0 in the positive path
failChan := make(chan struct{}, 1)
g1SvcMock := &gossipMock{}
g1SvcMock.On("JoinChan", mock.Anything, mock.Anything).Run(func(_ mock.Arguments) {
failChan <- struct{}{}
})
g1 := &gossipServiceImpl{secAdv: &secAdvMock{}, peerIdentity: api.PeerIdentityType("OrgMSP0"), gossipSvc: g1SvcMock}
g1.updateAnchors(&configMock{
orgs2AppOrgs: map[string]channelconfig.ApplicationOrg{
"Org0": &appOrgMock{id: "Org0"},
},
})
select {
case <-time.After(time.Second):
case <-failChan:
assert.Fail(t, "Joined a badly configured channel")
}
succChan := make(chan struct{}, 1)
g2SvcMock := &gossipMock{}
g2SvcMock.On("JoinChan", mock.Anything, mock.Anything).Run(func(_ mock.Arguments) {
succChan <- struct{}{}
})
g2 := &gossipServiceImpl{secAdv: &secAdvMock{}, peerIdentity: api.PeerIdentityType("Org0"), gossipSvc: g2SvcMock}
g2.updateAnchors(&configMock{
orgs2AppOrgs: map[string]channelconfig.ApplicationOrg{
"Org0": &appOrgMock{id: "Org0"},
},
})
select {
case <-time.After(time.Second):
assert.Fail(t, "Didn't join a channel (should have done so within the time period)")
case <-succChan:
}
} | explode_data.jsonl/20853 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 528
} | [
2830,
3393,
12292,
9629,
2648,
1155,
353,
8840,
836,
8,
341,
197,
322,
2463,
60494,
25,
576,
5496,
582,
2299,
18169,
702,
264,
3175,
1240,
481,
33706,
15,
198,
197,
322,
714,
1039,
1240,
3034,
374,
3520,
33706,
15,
44,
4592,
304,
27... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestCreateRouteMap(t *testing.T) {
authBase := middleware.AuthBase{Secret: "secret", Override: func(handlerFunc http.HandlerFunc) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
ctx := context.WithValue(r.Context(), AuthWasCalled, "true")
handlerFunc(w, r.WithContext(ctx))
}
}}
CatchallHandler := func(w http.ResponseWriter, r *http.Request) {
fmt.Fprint(w, "catchall")
}
PathOneHandler := func(w http.ResponseWriter, r *http.Request) {
ctx := r.Context()
authWasCalled := getAuthWasCalled(ctx)
fmt.Fprintf(w, "%s %s", "path1", authWasCalled)
}
PathTwoHandler := func(w http.ResponseWriter, r *http.Request) {
ctx := r.Context()
authWasCalled := getAuthWasCalled(ctx)
fmt.Fprintf(w, "%s %s", "path2", authWasCalled)
}
PathThreeHandler := func(w http.ResponseWriter, r *http.Request) {
ctx := r.Context()
authWasCalled := getAuthWasCalled(ctx)
fmt.Fprintf(w, "%s %s", "path3", authWasCalled)
}
PathFourHandler := func(w http.ResponseWriter, r *http.Request) {
fmt.Fprint(w, "path4")
}
PathFiveHandler := func(w http.ResponseWriter, r *http.Request) {
fmt.Fprint(w, "path5")
}
routes := []Route{
{api.Version{Major: 1, Minor: 2}, http.MethodGet, `path1`, PathOneHandler, auth.PrivLevelReadOnly, nil, true, nil, 0},
{api.Version{Major: 1, Minor: 2}, http.MethodGet, `path2`, PathTwoHandler, 0, nil, false, nil, 1},
{api.Version{Major: 1, Minor: 2}, http.MethodGet, `path3`, PathThreeHandler, 0, nil, false, []middleware.Middleware{}, 2},
{api.Version{Major: 1, Minor: 2}, http.MethodGet, `path4`, PathFourHandler, 0, nil, false, []middleware.Middleware{}, 3},
{api.Version{Major: 1, Minor: 2}, http.MethodGet, `path5`, PathFiveHandler, 0, nil, false, []middleware.Middleware{}, 4},
}
disabledRoutesIDs := []int{4}
routeMap, _ := CreateRouteMap(routes, disabledRoutesIDs, CatchallHandler, authBase, 60)
route1Handler := routeMap["GET"][0].Handler
w := httptest.NewRecorder()
r, err := http.NewRequest("", "/", nil)
if err != nil {
t.Error("Error creating new request")
}
route1Handler(w, r)
if bytes.Compare(w.Body.Bytes(), []byte("path1 true")) != 0 {
t.Errorf("Got: %s \nExpected to receive path1 true\n", w.Body.Bytes())
}
route2Handler := routeMap["GET"][1].Handler
w = httptest.NewRecorder()
route2Handler(w, r)
if bytes.Compare(w.Body.Bytes(), []byte("path2 false")) != 0 {
t.Errorf("Got: %s \nExpected to receive path2 false\n", w.Body.Bytes())
}
if v, ok := w.HeaderMap["Access-Control-Allow-Credentials"]; !ok || len(v) != 1 || v[0] != "true" {
t.Errorf(`Expected Access-Control-Allow-Credentials: [ "true" ]`)
}
route3Handler := routeMap["GET"][2].Handler
w = httptest.NewRecorder()
route3Handler(w, r)
if bytes.Compare(w.Body.Bytes(), []byte("path3 false")) != 0 {
t.Errorf("Got: %s \nExpected to receive path3 false\n", w.Body.Bytes())
}
if v, ok := w.HeaderMap["Access-Control-Allow-Credentials"]; ok {
t.Errorf("Unexpected Access-Control-Allow-Credentials: %s", v)
}
// request should be handled by Catchall
route4Handler := routeMap["GET"][3].Handler
w = httptest.NewRecorder()
route4Handler(w, r)
if bytes.Compare(w.Body.Bytes(), []byte("path4")) != 0 {
t.Errorf("Expected: 'path4', actual: %s", w.Body.Bytes())
}
// request should be handled by DisabledRouteHandler
route5Handler := routeMap["GET"][4].Handler
w = httptest.NewRecorder()
route5Handler(w, r)
if bytes.Compare(w.Body.Bytes(), []byte("path5")) == 0 {
t.Errorf("Expected: not 'path5', actual: '%s'", w.Body.Bytes())
}
if w.Result().StatusCode != http.StatusServiceUnavailable {
t.Errorf("Expected status: %d, actual: %d", http.StatusServiceUnavailable, w.Result().StatusCode)
}
} | explode_data.jsonl/26147 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 1427
} | [
2830,
3393,
4021,
4899,
2227,
1155,
353,
8840,
836,
8,
341,
78011,
3978,
1669,
29679,
25233,
3978,
90,
19773,
25,
330,
20474,
497,
38258,
25,
2915,
36514,
9626,
1758,
89164,
8,
1758,
89164,
341,
197,
853,
2915,
3622,
1758,
37508,
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 TestTaskAt(t *testing.T) {
// Create new scheduler to have clean test env
s := NewScheduler()
// Schedule to run in next minute
now := time.Now()
// Schedule every day At
startAt := fmt.Sprintf("%02d:%02d", now.Hour(), now.Add(time.Minute).Minute())
dayJob := s.Every(1).Day().At(startAt)
dayJobDone := make(chan bool, 1)
dayJob.Do(func() {
dayJobDone <- true
})
// Expected start time
expectedStartTime := time.Date(now.Year(), now.Month(), now.Day(), now.Hour(), now.Add(time.Minute).Minute(), 0, 0, loc)
nextRun := dayJob.NextScheduledTime()
assert.Equal(t, expectedStartTime, nextRun)
sStop := s.Start()
<-dayJobDone // Wait job done
close(sStop)
time.Sleep(time.Second) // wait for scheduler to reschedule job
// Expected next start time 1 day after
expectedNextRun := expectedStartTime.AddDate(0, 0, 1)
nextRun = dayJob.NextScheduledTime()
assert.Equal(t, expectedNextRun, nextRun)
} | explode_data.jsonl/63501 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 333
} | [
2830,
3393,
6262,
1655,
1155,
353,
8840,
836,
8,
341,
197,
322,
4230,
501,
28809,
311,
614,
4240,
1273,
6105,
198,
1903,
1669,
1532,
38878,
2822,
197,
322,
23512,
311,
1598,
304,
1790,
9383,
198,
80922,
1669,
882,
13244,
741,
197,
322... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestGenerateModel_NotaWithRefRegistry(t *testing.T) {
specDoc, err := loads.Spec("../fixtures/codegen/todolist.models.yml")
require.NoError(t, err)
definitions := specDoc.Spec().Definitions
k := "NotaWithRefRegistry"
schema := definitions[k]
opts := opts()
genModel, err := makeGenDefinition(k, "models", schema, specDoc, opts)
require.NoError(t, err)
buf := bytes.NewBuffer(nil)
require.NoError(t, opts.templates.MustGet("model").Execute(buf, genModel))
ff, err := opts.LanguageOpts.FormatContent("nota_with_ref_registry.go", buf.Bytes())
require.NoError(t, err)
assertInCode(t, "type "+k+" map[string]map[string]map[string]Notable", string(ff))
} | explode_data.jsonl/2503 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 251
} | [
2830,
3393,
31115,
1712,
1604,
6089,
2354,
3945,
15603,
1155,
353,
8840,
836,
8,
341,
98100,
9550,
11,
1848,
1669,
20907,
36473,
17409,
45247,
46928,
4370,
5523,
347,
34675,
8235,
33936,
1138,
17957,
35699,
1155,
11,
1848,
692,
7452,
4054... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestQueryExprWithQueryOption(t *testing.T) {
db := DB.New()
queryExpr := db.Model(User{}).Select("users.id").
Set("gorm:query_option", "WHERE users.name='user2'").
QueryExpr()
matched, _ := regexp.MatchString(
`^&{.+\s+WHERE users\.name='user2'.*\s\[]}$`, fmt.Sprint(queryExpr))
if !matched {
t.Error("Unexpected result of QueryExpr with query_option")
}
} | explode_data.jsonl/28072 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 152
} | [
2830,
3393,
2859,
16041,
2354,
2859,
5341,
1155,
353,
8840,
836,
8,
341,
20939,
1669,
5952,
7121,
2822,
27274,
16041,
1669,
2927,
5659,
13087,
6257,
568,
3379,
445,
4218,
1764,
38609,
197,
22212,
445,
73281,
25,
1631,
9672,
497,
330,
26... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 Test_RegistrySynchronizer_FullSync(t *testing.T) {
db, synchronizer, ethMock, _, job := setupRegistrySync(t)
contractAddress := job.KeeperSpec.ContractAddress.Address()
fromAddress := job.KeeperSpec.FromAddress.Address()
registryMock := cltest.NewContractMockReceiver(t, ethMock, keeper.RegistryABI, contractAddress)
canceledUpkeeps := []*big.Int{big.NewInt(1)}
registryMock.MockResponse("getConfig", registryConfig).Once()
registryMock.MockResponse("getKeeperList", []common.Address{fromAddress}).Once()
registryMock.MockResponse("getCanceledUpkeepList", canceledUpkeeps).Once()
registryMock.MockResponse("getUpkeepCount", big.NewInt(3)).Once()
registryMock.MockResponse("getUpkeep", upkeepConfig).Times(3) // sync all 3, then delete
synchronizer.ExportedFullSync()
cltest.AssertCount(t, db, "keeper_registries", 1)
cltest.AssertCount(t, db, "upkeep_registrations", 2)
var registry keeper.Registry
var upkeepRegistration keeper.UpkeepRegistration
require.NoError(t, db.Get(®istry, `SELECT * FROM keeper_registries`))
require.NoError(t, db.Get(&upkeepRegistration, `SELECT * FROM upkeep_registrations`))
require.Equal(t, job.KeeperSpec.ContractAddress, registry.ContractAddress)
require.Equal(t, job.KeeperSpec.FromAddress, registry.FromAddress)
require.Equal(t, int32(20), registry.BlockCountPerTurn)
require.Equal(t, int32(0), registry.KeeperIndex)
require.Equal(t, int32(1), registry.NumKeepers)
require.Equal(t, upkeepConfig.CheckData, upkeepRegistration.CheckData)
require.Equal(t, uint64(upkeepConfig.ExecuteGas), upkeepRegistration.ExecuteGas)
assertUpkeepIDs(t, db, []int64{0, 2})
ethMock.AssertExpectations(t)
// 2nd sync
canceledUpkeeps = []*big.Int{big.NewInt(0), big.NewInt(1), big.NewInt(3)}
registryMock.MockResponse("getConfig", registryConfig).Once()
registryMock.MockResponse("getKeeperList", []common.Address{fromAddress}).Once()
registryMock.MockResponse("getCanceledUpkeepList", canceledUpkeeps).Once()
registryMock.MockResponse("getUpkeepCount", big.NewInt(5)).Once()
registryMock.MockResponse("getUpkeep", upkeepConfig).Times(2) // two new upkeeps to sync
synchronizer.ExportedFullSync()
cltest.AssertCount(t, db, "keeper_registries", 1)
cltest.AssertCount(t, db, "upkeep_registrations", 2)
assertUpkeepIDs(t, db, []int64{2, 4})
ethMock.AssertExpectations(t)
} | explode_data.jsonl/35258 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 827
} | [
2830,
3393,
62,
15603,
50,
14113,
3135,
1400,
617,
12154,
1155,
353,
8840,
836,
8,
341,
20939,
11,
14121,
3135,
11,
8372,
11571,
11,
8358,
2618,
1669,
6505,
15603,
12154,
1155,
692,
197,
20257,
4286,
1669,
2618,
11352,
43031,
8327,
6946... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestNodeAffinity(t *testing.T) {
clientset := test.New(3)
c := New(&clusterd.Context{Clientset: clientset}, "ns", "", "myversion", cephv1beta1.CephVersionSpec{},
cephv1beta1.MonSpec{Count: 3, AllowMultiplePerNode: true}, rookalpha.Placement{},
false, v1.ResourceRequirements{}, metav1.OwnerReference{})
c.clusterInfo = test.CreateConfigDir(0)
nodes, err := c.getMonNodes()
assert.Nil(t, err)
assert.Equal(t, 3, len(nodes))
c.placement.NodeAffinity = &v1.NodeAffinity{
RequiredDuringSchedulingIgnoredDuringExecution: &v1.NodeSelector{
NodeSelectorTerms: []v1.NodeSelectorTerm{
{
MatchExpressions: []v1.NodeSelectorRequirement{
{
Key: "label",
Operator: v1.NodeSelectorOpIn,
Values: []string{"bar", "baz"},
},
},
},
},
},
}
// label nodes so node0 will not be schedulable for new pods
nodes[0].Labels = map[string]string{"label": "foo"}
nodes[1].Labels = map[string]string{"label": "bar"}
nodes[2].Labels = map[string]string{"label": "baz"}
clientset.CoreV1().Nodes().Update(&nodes[0])
clientset.CoreV1().Nodes().Update(&nodes[1])
clientset.CoreV1().Nodes().Update(&nodes[2])
cleanNodes, err := c.getMonNodes()
assert.Nil(t, err)
assert.Equal(t, 2, len(cleanNodes))
assert.Equal(t, nodes[1].Name, cleanNodes[0].Name)
assert.Equal(t, nodes[2].Name, cleanNodes[1].Name)
} | explode_data.jsonl/39534 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 592
} | [
2830,
3393,
1955,
25841,
13489,
1155,
353,
8840,
836,
8,
341,
25291,
746,
1669,
1273,
7121,
7,
18,
340,
1444,
1669,
1532,
2099,
18855,
67,
9328,
90,
2959,
746,
25,
2943,
746,
2137,
330,
4412,
497,
7342,
330,
2408,
4366,
497,
272,
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 Test_tryReadFromRoaring32WithRoaring64(t *testing.T) {
r64 := BitmapOf(1, 65535, math.MaxUint32, math.MaxUint64)
bs, err := r64.ToBytes()
if err != nil {
t.Fatal(err)
}
nr64 := NewBitmap()
assert.True(t, nr64.UnmarshalBinary(bs) == nil)
assert.True(t, nr64.Contains(1))
assert.True(t, nr64.Contains(65535))
assert.True(t, nr64.Contains(math.MaxUint32))
assert.True(t, nr64.Contains(math.MaxUint64))
} | explode_data.jsonl/20358 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 195
} | [
2830,
3393,
53283,
4418,
3830,
38872,
3249,
18,
17,
2354,
38872,
3249,
21,
19,
1155,
353,
8840,
836,
8,
341,
7000,
21,
19,
1669,
17533,
2124,
7,
16,
11,
220,
21,
20,
20,
18,
20,
11,
6888,
14535,
21570,
18,
17,
11,
6888,
14535,
2... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
func TestSaveArtifacts(t *testing.T) {
bh := testBuildHandler()
bh.config.WorkingDir = "/working-dir"
bh.config.Tag = "image/tag"
fs := bh.fs.(*test.FakeFileSystem)
fd := bh.docker.(*docker.FakeDocker)
th := bh.tar.(*test.FakeTar)
err := bh.Save(bh.config)
if err != nil {
t.Errorf("Unexpected error when saving artifacts: %v", err)
}
expectedArtifactDir := "/working-dir/upload/artifacts"
if fs.MkdirDir != expectedArtifactDir {
t.Errorf("Mkdir was not called with the expected directory: %s",
fs.MkdirDir)
}
if fd.RunContainerOpts.Image != bh.config.Tag {
t.Errorf("Unexpected image sent to RunContainer: %s",
fd.RunContainerOpts.Image)
}
if th.ExtractTarDir != expectedArtifactDir || th.ExtractTarReader == nil {
t.Errorf("ExtractTar was not called with the expected parameters.")
}
} | explode_data.jsonl/59440 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 308
} | [
2830,
3393,
8784,
9286,
26401,
1155,
353,
8840,
836,
8,
341,
2233,
71,
1669,
1273,
11066,
3050,
741,
2233,
71,
5423,
28748,
287,
6184,
284,
3521,
21152,
45283,
698,
2233,
71,
5423,
23676,
284,
330,
1805,
76196,
698,
53584,
1669,
42989,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestQueryDeveloperOK(t *testing.T) {
testServer(func(s *core.Server) {
headers := make(map[string]string)
headers["X-Access-Token"] = accessToken
url := "/api/v1/developers/" + devID
//make request
res, err := testHTTPRequestWithHeaders("GET", url, ``, headers)
if err != nil {
t.Fatalf("unable to query: %v , %v", url, err)
} else {
body, _ := ioutil.ReadAll(res.Body)
if res.StatusCode != 200 {
t.Fatalf("unable to query: %v , %v", url, string(body))
}
//fmt.Printf("query response: %v \n", string(body))
}
})
} | explode_data.jsonl/42210 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 233
} | [
2830,
3393,
2859,
44911,
3925,
1155,
353,
8840,
836,
8,
1476,
18185,
5475,
18552,
1141,
353,
2153,
22997,
8,
1476,
197,
67378,
1669,
1281,
9147,
14032,
30953,
340,
197,
67378,
1183,
55,
12,
6054,
89022,
1341,
284,
37725,
271,
197,
19320... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
func TestPercentEncodeSlash(t *testing.T) {
testCases := []struct {
input string
output string
}{
{"test123", "test123"},
{"abc,+_1", "abc,+_1"},
{"%40prefix=test%40123", "%40prefix=test%40123"},
{"key1=val1/val2", "key1=val1%2Fval2"},
{"%40prefix=test%40123/", "%40prefix=test%40123%2F"},
}
for i, testCase := range testCases {
receivedOutput := percentEncodeSlash(testCase.input)
if testCase.output != receivedOutput {
t.Errorf(
"Test %d: Input: \"%s\" --> Expected percentEncodeSlash to return \"%s\", but it returned \"%s\" instead!",
i+1, testCase.input, testCase.output,
receivedOutput,
)
}
}
} | explode_data.jsonl/20472 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 273
} | [
2830,
3393,
32010,
32535,
88004,
1155,
353,
8840,
836,
8,
341,
18185,
37302,
1669,
3056,
1235,
341,
197,
22427,
220,
914,
198,
197,
21170,
914,
198,
197,
59403,
197,
197,
4913,
1944,
16,
17,
18,
497,
330,
1944,
16,
17,
18,
7115,
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 TestUpdateEngineForRestart(t *testing.T) {
tests := map[string]struct {
engine chaosTypes.EngineInfo
isErr bool
}{
"Test Positive-1": {
engine: chaosTypes.EngineInfo{
Instance: &v1alpha1.ChaosEngine{
ObjectMeta: metav1.ObjectMeta{
Name: "engine-restart-p1",
Namespace: "default",
},
Spec: v1alpha1.ChaosEngineSpec{
Appinfo: v1alpha1.ApplicationParams{
Applabel: "app=nginx",
AppKind: "deployment",
},
EngineState: v1alpha1.EngineStateActive,
AnnotationCheck: "false",
Components: v1alpha1.ComponentParams{
Runner: v1alpha1.RunnerInfo{
Image: "fake-runner-image",
},
},
Experiments: []v1alpha1.ExperimentList{
{
Name: "exp-1",
},
},
},
Status: v1alpha1.ChaosEngineStatus{
EngineStatus: v1alpha1.EngineStatusCompleted,
},
},
},
isErr: false,
},
"Test Positive-2": {
engine: chaosTypes.EngineInfo{
Instance: &v1alpha1.ChaosEngine{
ObjectMeta: metav1.ObjectMeta{
Name: "engine-restart-p2",
Namespace: "default",
},
Spec: v1alpha1.ChaosEngineSpec{
Appinfo: v1alpha1.ApplicationParams{
Applabel: "app=nginx",
AppKind: "deployment",
},
EngineState: v1alpha1.EngineStateActive,
AnnotationCheck: "false",
Experiments: []v1alpha1.ExperimentList{
{
Name: "exp-1",
},
},
},
Status: v1alpha1.ChaosEngineStatus{
EngineStatus: v1alpha1.EngineStatusInitialized,
},
},
},
isErr: false,
},
}
for name, mock := range tests {
t.Run(name, func(t *testing.T) {
r := CreateFakeClient(t)
err := r.client.Create(context.TODO(), mock.engine.Instance)
if err != nil {
fmt.Printf("Unable to create engine: %v", err)
}
err = r.updateEngineForRestart(&mock.engine)
if mock.isErr && err == nil {
t.Fatalf("Test %q failed: expected error not to be nil", name)
}
if !mock.isErr && err != nil {
t.Fatalf("Test %q failed: expected error to be nil", name)
}
})
}
} | explode_data.jsonl/32128 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 1041
} | [
2830,
3393,
4289,
4571,
2461,
59354,
1155,
353,
8840,
836,
8,
341,
78216,
1669,
2415,
14032,
60,
1235,
341,
197,
80118,
26915,
4173,
54424,
1731,
198,
197,
19907,
7747,
220,
1807,
198,
197,
59403,
197,
197,
1,
2271,
43903,
12,
16,
788... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 6 |
func TestGetDisk(t *testing.T) {
ctrl := gomock.NewController(t)
defer ctrl.Finish()
fakeGetDiskFailed := "fakeGetDiskFailed"
testCases := []struct {
desc string
diskName string
existedDisk compute.Disk
expectedErr bool
expectedErrMsg error
expectedProvisioningState string
expectedDiskID string
}{
{
desc: "no error shall be returned if get a normal disk without DiskProperties",
diskName: "disk1",
existedDisk: compute.Disk{Name: to.StringPtr("disk1")},
expectedErr: false,
expectedProvisioningState: "",
expectedDiskID: "",
},
{
desc: "an error shall be returned if get disk failed",
diskName: fakeGetDiskFailed,
existedDisk: compute.Disk{Name: to.StringPtr(fakeGetDiskFailed)},
expectedErr: true,
expectedErrMsg: fmt.Errorf("Retriable: false, RetryAfter: 0s, HTTPStatusCode: 0, RawError: %w", fmt.Errorf("Get Disk failed")),
expectedProvisioningState: "",
expectedDiskID: "",
},
}
for i, test := range testCases {
testCloud := GetTestCloud(ctrl)
managedDiskController := testCloud.ManagedDiskController
mockDisksClient := testCloud.DisksClient.(*mockdiskclient.MockInterface)
if test.diskName == fakeGetDiskFailed {
mockDisksClient.EXPECT().Get(gomock.Any(), testCloud.ResourceGroup, test.diskName).Return(test.existedDisk, &retry.Error{RawError: fmt.Errorf("Get Disk failed")}).AnyTimes()
} else {
mockDisksClient.EXPECT().Get(gomock.Any(), testCloud.ResourceGroup, test.diskName).Return(test.existedDisk, nil).AnyTimes()
}
provisioningState, diskid, err := managedDiskController.GetDisk(testCloud.ResourceGroup, test.diskName)
assert.Equal(t, test.expectedErr, err != nil, "TestCase[%d]: %s, return error: %v", i, test.desc, err)
assert.Equal(t, test.expectedErrMsg, err, "TestCase[%d]: %s, expected: %v, return: %v", i, test.desc, test.expectedErrMsg, err)
assert.Equal(t, test.expectedProvisioningState, provisioningState, "TestCase[%d]: %s, expected ProvisioningState: %v, return ProvisioningState: %v", i, test.desc, test.expectedProvisioningState, provisioningState)
assert.Equal(t, test.expectedDiskID, diskid, "TestCase[%d]: %s, expected DiskID: %v, return DiskID: %v", i, test.desc, test.expectedDiskID, diskid)
}
} | explode_data.jsonl/36147 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 1062
} | [
2830,
3393,
1949,
47583,
1155,
353,
8840,
836,
8,
341,
84381,
1669,
342,
316,
1176,
7121,
2051,
1155,
340,
16867,
23743,
991,
18176,
2822,
1166,
726,
1949,
47583,
9408,
1669,
330,
30570,
1949,
47583,
9408,
698,
18185,
37302,
1669,
3056,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
func TestDownloadSync(t *testing.T) {
var (
proxyURL = tutils.RandomProxyURL(t)
baseParams = tutils.BaseAPIParams(proxyURL)
bck = cmn.Bck{
Name: cos.RandString(10),
Provider: cmn.ProviderAIS,
}
dlBody = downloader.DlBackendBody{
DlBase: downloader.DlBase{Bck: bck},
}
m = &ioContext{
t: t,
num: 10,
bck: cliBck,
}
objsToDelete = 4
)
tutils.CheckSkip(t, tutils.SkipTestArgs{CloudBck: true, Bck: m.bck})
m.initWithCleanup()
m.remotePuts(false /*evict*/)
tutils.CreateBucketWithCleanup(t, proxyURL, bck, nil)
tutils.SetBackendBck(t, baseParams, bck, m.bck)
tlog.Logln("1. initial sync of remote bucket...")
dlBody.Sync = true
downloadObjectRemote(t, dlBody, m.num, 0)
downloadObjectRemote(t, dlBody, m.num, m.num)
m.del(objsToDelete)
// Check that only deleted objects are replaced (deleted in this case).
tlog.Logln("2. re-syncing remote bucket...")
downloadObjectRemote(t, dlBody, m.num, m.num-objsToDelete)
downloadObjectRemote(t, dlBody, m.num-objsToDelete, m.num-objsToDelete)
tlog.Logln("3. filling removed remote objects...")
m.remoteRefill()
// Check that new objects are correctly downloaded.
tlog.Logln("4. re-syncing remote bucket...")
downloadObjectRemote(t, dlBody, m.num, m.num-objsToDelete)
downloadObjectRemote(t, dlBody, m.num, m.num)
dlBody.Sync = false
downloadObjectRemote(t, dlBody, m.num, m.num)
tlog.Logln("5. overridding the objects and deleting some of them...")
m.remotePuts(false /*evict*/, true /*override*/)
m.del(objsToDelete)
// Check that all objects have been replaced.
tlog.Logln("6. re-syncing remote bucket...")
dlBody.Sync = true
downloadObjectRemote(t, dlBody, m.num, 0)
downloadObjectRemote(t, dlBody, m.num-objsToDelete, m.num-objsToDelete)
tlog.Logln("7. check that syncing with prefix and suffix works")
dlBody.Prefix = "someprefix-"
dlBody.Suffix = ""
downloadObjectRemote(t, dlBody, 0, 0)
dlBody.Prefix = ""
dlBody.Suffix = "somesuffix-"
downloadObjectRemote(t, dlBody, 0, 0)
} | explode_data.jsonl/70395 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 828
} | [
2830,
3393,
11377,
12154,
1155,
353,
8840,
836,
8,
341,
2405,
2399,
197,
197,
22803,
3144,
256,
284,
259,
6031,
26709,
16219,
3144,
1155,
340,
197,
24195,
4870,
284,
259,
6031,
13018,
7082,
4870,
65787,
3144,
340,
197,
2233,
377,
286,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestContainerSourceValidation(t *testing.T) {
tests := []struct {
name string
spec ContainerSourceSpec
want *apis.FieldError
}{{
name: "missing container",
spec: ContainerSourceSpec{
Template: corev1.PodTemplateSpec{},
SourceSpec: duckv1.SourceSpec{
Sink: duckv1.Destination{
Ref: &duckv1.KReference{
APIVersion: "v1beta1",
Kind: "Broker",
Name: "default",
},
},
},
},
want: func() *apis.FieldError {
var errs *apis.FieldError
fe := apis.ErrMissingField("containers")
errs = errs.Also(fe)
return errs
}(),
}, {
name: "missing container image",
spec: ContainerSourceSpec{
Template: corev1.PodTemplateSpec{
Spec: corev1.PodSpec{
Containers: []corev1.Container{{
Name: "test-name",
}},
},
},
SourceSpec: duckv1.SourceSpec{
Sink: duckv1.Destination{
Ref: &duckv1.KReference{
APIVersion: "eventing.knative.dev/v1",
Kind: "Broker",
Name: "default",
},
},
},
},
want: func() *apis.FieldError {
var errs *apis.FieldError
fe := apis.ErrMissingField("containers[0].image")
errs = errs.Also(fe)
return errs
}(),
}, {
name: "empty sink",
spec: ContainerSourceSpec{
Template: corev1.PodTemplateSpec{
Spec: corev1.PodSpec{
Containers: []corev1.Container{{
Name: "name",
Image: "image",
}},
},
},
SourceSpec: duckv1.SourceSpec{
Sink: duckv1.Destination{},
},
},
want: func() *apis.FieldError {
var errs *apis.FieldError
fe := apis.ErrGeneric("expected at least one, got none", "sink.ref", "sink.uri")
errs = errs.Also(fe)
return errs
}(),
},
}
for _, test := range tests {
t.Run(test.name, func(t *testing.T) {
got := test.spec.Validate(context.TODO())
if diff := cmp.Diff(test.want.Error(), got.Error()); diff != "" {
t.Error("ContainerSourceSpec.Validate (-want, +got) =", diff)
}
})
}
} | explode_data.jsonl/65991 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 929
} | [
2830,
3393,
4502,
3608,
13799,
1155,
353,
8840,
836,
8,
341,
78216,
1669,
3056,
1235,
341,
197,
11609,
914,
198,
197,
98100,
9678,
3608,
8327,
198,
197,
50780,
353,
13725,
17087,
1454,
198,
197,
15170,
515,
197,
11609,
25,
330,
30616,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestPlan(t *testing.T) {
for _, plan := range testPlans {
t.Logf("Testing %s", plan.desc)
anonymizerTemplate := types.AnonymizeTemplate{
FieldTypeTransformations: plan.fieldTypeTransformation,
DefaultTransformation: plan.defaultTransformation,
}
output, err := AnonymizeText(plan.text, plan.analyzeResults, &anonymizerTemplate)
assert.NoError(t, err)
assert.Equal(t, plan.expected, output)
}
} | explode_data.jsonl/21641 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 152
} | [
2830,
3393,
20485,
1155,
353,
8840,
836,
8,
341,
2023,
8358,
3119,
1669,
2088,
1273,
97728,
341,
197,
3244,
98954,
445,
16451,
1018,
82,
497,
3119,
30514,
692,
197,
79457,
7831,
3135,
7275,
1669,
4494,
875,
6280,
1600,
551,
7275,
515,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
func TestYouonM(t *testing.T) {
const want = "myamyumyomyamyimyumyemyo"
for _, v := range [2]string{"みゃみゅみょみぁみぃみぅみぇみぉ", "ミャミュミョミァミィミゥミェミォ"} {
got, err := KanaToRomaji(v)
assert.Equal(t, want, got)
assert.Nil(t, err)
}
} | explode_data.jsonl/11334 | {
"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,
2610,
263,
44,
1155,
353,
8840,
836,
8,
341,
4777,
1366,
284,
330,
2408,
26228,
372,
88,
5533,
26228,
318,
89652,
88,
4524,
78,
1837,
2023,
8358,
348,
1669,
2088,
508,
17,
30953,
4913,
63021,
124234,
63021,
138218,
63021,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestX12HandleEOD(t *testing.T) {
ctx, _ := NewEncoderContext("")
ctx.codewords = make([]byte, 1559)
e := x12HandleEOD(ctx, []byte{})
if e == nil {
t.Fatalf("x12HandleEOD must be error")
}
ctx, _ = NewEncoderContext("AAA0")
ctx.symbolInfo = symbols[10]
ctx.pos = 4
ctx.codewords = []byte{89, 191}
e = x12HandleEOD(ctx, []byte{1})
if e != nil {
t.Fatalf("x12HandleEOD returns error: %v", e)
}
if r := ctx.GetCodewords(); !reflect.DeepEqual(r, []byte{89, 191, 254}) {
t.Fatalf("context codewords = %v, expect [89 191 254]", r)
}
if ctx.pos != 3 {
t.Fatalf("context pos = %v, expect 3", ctx.pos)
}
} | explode_data.jsonl/49805 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 279
} | [
2830,
3393,
55,
16,
17,
6999,
36,
2069,
1155,
353,
8840,
836,
8,
341,
20985,
11,
716,
1669,
1532,
19921,
1972,
31764,
20985,
41067,
365,
2260,
284,
1281,
10556,
3782,
11,
220,
16,
20,
20,
24,
340,
7727,
1669,
856,
16,
17,
6999,
36... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestTypeSystem_ObjectsCanOnlyImplementInterfaces_RejectsAnObjectImplementingANonInterfaceType(t *testing.T) {
_, err := schemaWithObjectImplementingType(nil)
expectedError := `BadObject may only implement Interface types, it cannot implement: <nil>.`
if err == nil || err.Error() != expectedError {
t.Fatalf("Expected error: %v, got %v", expectedError, err)
}
} | explode_data.jsonl/79179 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 116
} | [
2830,
3393,
929,
2320,
62,
11543,
6713,
7308,
62980,
41066,
50693,
583,
82,
2082,
1190,
62980,
287,
1093,
263,
5051,
929,
1155,
353,
8840,
836,
8,
341,
197,
6878,
1848,
1669,
10802,
2354,
1190,
62980,
287,
929,
27907,
340,
42400,
1454,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestNamespaceWithUndefinedOptionalsUpdate(t *testing.T) {
resourceName := "pulsar_namespace.test"
cName := acctest.RandString(10)
tName := acctest.RandString(10)
nsName := acctest.RandString(10)
resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Providers: testAccProviders,
IDRefreshName: resourceName,
CheckDestroy: testPulsarNamespaceDestroy,
Steps: []resource.TestStep{
{
Config: testPulsarNamespaceWithoutOptionals(testWebServiceURL, cName, tName, nsName),
Check: resource.ComposeTestCheckFunc(
testPulsarNamespaceExists(resourceName),
resource.TestCheckResourceAttr(resourceName, "dispatch_rate.#", "0"),
resource.TestCheckResourceAttr(resourceName, "retention_policies.#", "0"),
resource.TestCheckResourceAttr(resourceName, "backlog_quota.#", "0"),
resource.TestCheckResourceAttr(resourceName, "namespace_config.#", "0"),
resource.TestCheckNoResourceAttr(resourceName, "enable_deduplication"),
resource.TestCheckNoResourceAttr(resourceName, "permission_grant"),
),
},
{
Config: testPulsarNamespaceWithUndefinedOptionalsInNsConf(testWebServiceURL, cName, tName, nsName),
Check: resource.ComposeTestCheckFunc(
testPulsarNamespaceExists(resourceName),
resource.TestCheckResourceAttr(resourceName, "dispatch_rate.#", "0"),
resource.TestCheckResourceAttr(resourceName, "retention_policies.#", "0"),
resource.TestCheckResourceAttr(resourceName, "backlog_quota.#", "0"),
resource.TestCheckResourceAttr(resourceName, "namespace_config.#", "1"),
resource.TestCheckNoResourceAttr(resourceName, "enable_deduplication"),
resource.TestCheckNoResourceAttr(resourceName, "permission_grant"),
),
ExpectNonEmptyPlan: true,
},
},
})
} | explode_data.jsonl/4691 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 676
} | [
2830,
3393,
22699,
2354,
30571,
5341,
1127,
4289,
1155,
353,
8840,
836,
8,
1476,
50346,
675,
1669,
330,
79,
14295,
277,
41571,
5958,
698,
1444,
675,
1669,
1613,
67880,
2013,
437,
703,
7,
16,
15,
340,
3244,
675,
1669,
1613,
67880,
2013... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestTransactionQueue(t *testing.T) {
t.Parallel()
pool, key := setupTxPool()
defer pool.Stop()
tx := transaction(0, 100, key)
from, _ := deriveSender(tx)
pool.currentState.AddBalance(from, big.NewInt(1000))
<-pool.requestReset(nil, nil)
pool.enqueueTx(tx.Hash(), tx)
<-pool.requestPromoteExecutables(newAccountSet(pool.signer, from))
if len(pool.pending) != 1 {
t.Error("expected valid txs to be 1 is", len(pool.pending))
}
tx = transaction(1, 100, key)
from, _ = deriveSender(tx)
pool.currentState.SetNonce(from, 2)
pool.enqueueTx(tx.Hash(), tx)
<-pool.requestPromoteExecutables(newAccountSet(pool.signer, from))
if _, ok := pool.pending[from].txs.items[tx.Nonce()]; ok {
t.Error("expected transaction to be in tx pool")
}
if len(pool.queue) > 0 {
t.Error("expected transaction queue to be empty. is", len(pool.queue))
}
} | explode_data.jsonl/7856 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 332
} | [
2830,
3393,
8070,
7554,
1155,
353,
8840,
836,
8,
341,
3244,
41288,
7957,
2822,
85273,
11,
1376,
1669,
6505,
31584,
10551,
741,
16867,
7314,
30213,
2822,
46237,
1669,
7745,
7,
15,
11,
220,
16,
15,
15,
11,
1376,
340,
42727,
11,
716,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestGarbageCollectionNEG(t *testing.T) {
kubeClient := fake.NewSimpleClientset()
if _, err := kubeClient.Core().Endpoints(testServiceNamespace).Create(getDefaultEndpoint()); err != nil {
t.Fatalf("Failed to create endpoint: %v", err)
}
manager := NewTestSyncerManager(kubeClient)
ports := make(types.PortNameMap)
ports[80] = "namedport"
if err := manager.EnsureSyncers(testServiceNamespace, testServiceName, ports); err != nil {
t.Fatalf("Failed to ensure syncer: %v", err)
}
negName := manager.namer.NEG("test", "test", 80)
manager.cloud.CreateNetworkEndpointGroup(&compute.NetworkEndpointGroup{
Name: negName,
}, negtypes.TestZone1)
if err := manager.GC(); err != nil {
t.Fatalf("Failed to GC: %v", err)
}
negs, _ := manager.cloud.ListNetworkEndpointGroup(negtypes.TestZone1)
for _, neg := range negs {
if neg.Name == negName {
t.Errorf("Expect NEG %q to be GCed.", negName)
}
}
// make sure there is no leaking go routine
manager.StopSyncer(testServiceNamespace, testServiceName)
} | explode_data.jsonl/19366 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 368
} | [
2830,
3393,
43930,
20652,
6482,
97127,
1155,
353,
8840,
836,
8,
341,
16463,
3760,
2959,
1669,
12418,
7121,
16374,
2959,
746,
741,
743,
8358,
1848,
1669,
80958,
2959,
12777,
1005,
80786,
8623,
1860,
22699,
568,
4021,
5433,
3675,
27380,
134... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestMissionControl(t *testing.T) {
ctx := createMcTestContext(t)
defer ctx.cleanup()
ctx.now = testTime
testTime := time.Date(2018, time.January, 9, 14, 00, 00, 0, time.UTC)
// For local channels, we expect a higher probability than our a prior
// test probability.
selfP := ctx.mc.GetProbability(mcTestSelf, mcTestNode1, 100)
if selfP != prevSuccessProbability {
t.Fatalf("expected prev success prob for untried local chans")
}
// Initial probability is expected to be the a priori.
ctx.expectP(1000, testAprioriHopProbability)
// Expect probability to be zero after reporting the edge as failed.
ctx.reportFailure(1000, lnwire.NewTemporaryChannelFailure(nil))
ctx.expectP(1000, 0)
// As we reported with a min penalization amt, a lower amt than reported
// should return the node probability, which is the a priori
// probability.
ctx.expectP(500, testAprioriHopProbability)
// Edge decay started. The node probability weighted average should now
// have shifted from 1:1 to 1:0.5 -> 60%. The connection probability is
// half way through the recovery, so we expect 30% here.
ctx.now = testTime.Add(30 * time.Minute)
ctx.expectP(1000, 0.3)
// Edge fails again, this time without a min penalization amt. The edge
// should be penalized regardless of amount.
ctx.reportFailure(0, lnwire.NewTemporaryChannelFailure(nil))
ctx.expectP(1000, 0)
ctx.expectP(500, 0)
// Edge decay started.
ctx.now = testTime.Add(60 * time.Minute)
ctx.expectP(1000, 0.3)
// Restart mission control to test persistence.
ctx.restartMc()
ctx.expectP(1000, 0.3)
// A node level failure should bring probability of all known channels
// back to zero.
ctx.reportFailure(0, lnwire.NewExpiryTooSoon(lnwire.ChannelUpdate{}))
ctx.expectP(1000, 0)
// Check whether history snapshot looks sane.
history := ctx.mc.GetHistorySnapshot()
if len(history.Pairs) != 3 {
t.Fatalf("expected 3 pairs, but got %v", len(history.Pairs))
}
// Test reporting a success.
ctx.reportSuccess()
} | explode_data.jsonl/25421 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 665
} | [
2830,
3393,
55951,
3273,
1155,
353,
8840,
836,
8,
341,
20985,
1669,
1855,
25286,
2271,
1972,
1155,
340,
16867,
5635,
87689,
2822,
20985,
10700,
284,
1273,
1462,
271,
18185,
1462,
1669,
882,
8518,
7,
17,
15,
16,
23,
11,
882,
3503,
276,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
func TestDuplicateHeaders(t *testing.T) {
input := strings.NewReader("A,B,C,A\n1,2,3,4")
r := NewReader(input)
headers, err := r.Headers()
if headers != nil {
t.Errorf("Unexpected headers: %v", headers)
}
if err != ErrDuplicateHeaders {
t.Errorf("Unexpected error: %v", err)
}
} | explode_data.jsonl/21912 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 122
} | [
2830,
3393,
53979,
10574,
1155,
353,
8840,
836,
8,
1476,
22427,
1669,
9069,
68587,
445,
32,
8161,
11289,
15031,
1699,
16,
11,
17,
11,
18,
11,
19,
1138,
7000,
1669,
1532,
5062,
5384,
692,
67378,
11,
1848,
1669,
435,
43968,
741,
743,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
func TestMobileApp_Audits(t *testing.T) {
t.Parallel()
db, _ := testDatabaseInstance.NewDatabase(t, nil)
realm1 := NewRealmWithDefaults("realm1")
if err := db.SaveRealm(realm1, SystemTest); err != nil {
t.Fatal(err)
}
app1 := &MobileApp{
Name: "app1",
RealmID: realm1.ID,
URL: "https://example1.com",
OS: OSTypeIOS,
AppID: "app1",
}
if err := db.SaveMobileApp(app1, SystemTest); err != nil {
t.Fatal(err)
}
app1.Name = "New Name"
app1.URL = "https://new.url"
app1.OS = OSTypeAndroid
app1.AppID = "appNew"
app1.SHA = "AA:AA:AA:AA:AA:AA:AA:AA:AA:AA:AA:AA:AA:AA:AA:AA:AA:AA:AA:AA:AA:AA:AA:AA:AA:AA:AA:AA:AA:AA:AA:AA"
if err := db.SaveMobileApp(app1, SystemTest); err != nil {
t.Fatalf("%v, %v", err, app1.errors)
}
audits, _, err := db.ListAudits(&pagination.PageParams{Limit: 100})
if err != nil {
t.Fatal(err)
}
if got, want := len(audits), 6; got != want {
t.Errorf("expected %d audits, got %d: %v", want, got, audits)
}
} | explode_data.jsonl/42279 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 467
} | [
2830,
3393,
18370,
2164,
1566,
661,
1199,
1155,
353,
8840,
836,
8,
341,
3244,
41288,
7957,
2822,
20939,
11,
716,
1669,
1273,
5988,
2523,
7121,
5988,
1155,
11,
2092,
692,
17200,
7673,
16,
1669,
1532,
64290,
2354,
16273,
445,
69897,
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... | 6 |
func TestPressure(t *testing.T) {
// SI derived
assertFloatEqual(t, 1e3, (1 * Zeptopascal).Yoctopascals())
assertFloatEqual(t, 1e3, (1 * Attopascal).Zeptopascals())
assertFloatEqual(t, 1e3, (1 * Femtopascal).Attopascals())
assertFloatEqual(t, 1e3, (1 * Picopascal).Femtopascals())
assertFloatEqual(t, 1e3, (1 * Nanopascal).Picopascals())
assertFloatEqual(t, 1e3, (1 * Micropascal).Nanopascals())
assertFloatEqual(t, 1e3, (1 * Millipascal).Micropascals())
assertFloatEqual(t, 1e3, (1 * Pascal).Millipascals())
assertFloatEqual(t, 1e2, (1 * Pascal).Centipascals())
assertFloatEqual(t, 1e1, (1 * Pascal).Decipascals())
assertFloatEqual(t, 1e0, (1 * Pascal).Pascals())
assertFloatEqual(t, 1e-1, (1 * Pascal).Decapascals())
assertFloatEqual(t, 1e-2, (1 * Pascal).Hectopascals())
assertFloatEqual(t, 1e-3, (1 * Pascal).Kilopascals())
assertFloatEqual(t, 1e-3, (1 * Kilopascal).Megapascals())
assertFloatEqual(t, 1e-3, (1 * Megapascal).Gigapascals())
assertFloatEqual(t, 1e-3, (1 * Gigapascal).Terapascals())
assertFloatEqual(t, 1e-3, (1 * Terapascal).Petapascals())
assertFloatEqual(t, 1e-3, (1 * Petapascal).Exapascals())
assertFloatEqual(t, 1e-3, (1 * Exapascal).Zettapascals())
assertFloatEqual(t, 1e-3, (1 * Zettapascal).Yottapascals())
// non-SI
assertFloatEqual(t, 1e3, (1 * Zeptobar).Yoctobars())
assertFloatEqual(t, 1e3, (1 * Attobar).Zeptobars())
assertFloatEqual(t, 1e3, (1 * Femtobar).Attobars())
assertFloatEqual(t, 1e3, (1 * Picobar).Femtobars())
assertFloatEqual(t, 1e3, (1 * Nanobar).Picobars())
assertFloatEqual(t, 1e3, (1 * Microbar).Nanobars())
assertFloatEqual(t, 1e3, (1 * Millibar).Microbars())
assertFloatEqual(t, 1e3, (1 * Bar).Millibars())
assertFloatEqual(t, 1e2, (1 * Bar).Centibars())
assertFloatEqual(t, 1e1, (1 * Bar).Decibars())
assertFloatEqual(t, 1e0, (1 * Bar).Bars())
assertFloatEqual(t, 1e-1, (1 * Bar).Decabars())
assertFloatEqual(t, 1e-2, (1 * Bar).Hectobars())
assertFloatEqual(t, 1e-3, (1 * Bar).Kilobars())
assertFloatEqual(t, 1e-3, (1 * Kilobar).Megabars())
assertFloatEqual(t, 1e-3, (1 * Megabar).Gigabars())
assertFloatEqual(t, 1e-3, (1 * Gigabar).Terabars())
assertFloatEqual(t, 1e-3, (1 * Terabar).Petabars())
assertFloatEqual(t, 1e-3, (1 * Petabar).Exabars())
assertFloatEqual(t, 1e-3, (1 * Exabar).Zettabars())
assertFloatEqual(t, 1e-3, (1 * Zettabar).Yottabars())
// misc
assertFloatEqual(t, 0.09869232667160129, (10000 * Pascal).Atmospheres())
assertFloatEqual(t, 0.10197162129779283, (10000 * Pascal).TechAtmospheres())
assertFloatEqual(t, 75.00615050434136, (10000 * Pascal).Torrs())
assertFloatEqual(t, 1.4503683935719673, (10000 * Pascal).PoundsPerSquareInch())
} | explode_data.jsonl/56540 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 1178
} | [
2830,
3393,
68269,
1155,
353,
8840,
836,
8,
1476,
197,
322,
30548,
14257,
198,
6948,
5442,
2993,
1155,
11,
220,
16,
68,
18,
11,
320,
16,
353,
9919,
417,
453,
35840,
568,
56,
41692,
453,
5061,
1127,
2398,
6948,
5442,
2993,
1155,
11,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestToRPCErr(t *testing.T) {
for _, test := range []struct {
// input
errIn error
// outputs
errOut error
}{
{transport.StreamError{Code: codes.Unknown, Desc: ""}, status.Error(codes.Unknown, "")},
{transport.ErrConnClosing, status.Error(codes.Unavailable, transport.ErrConnClosing.Desc)},
} {
err := toRPCErr(test.errIn)
if _, ok := status.FromError(err); !ok {
t.Fatalf("toRPCErr{%v} returned type %T, want %T", test.errIn, err, status.Error(codes.Unknown, ""))
}
if !reflect.DeepEqual(err, test.errOut) {
t.Fatalf("toRPCErr{%v} = %v \nwant %v", test.errIn, err, test.errOut)
}
}
} | explode_data.jsonl/18343 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 264
} | [
2830,
3393,
1249,
21657,
2104,
634,
1155,
353,
8840,
836,
8,
341,
2023,
8358,
1273,
1669,
2088,
3056,
1235,
341,
197,
197,
322,
1946,
198,
197,
9859,
641,
1465,
198,
197,
197,
322,
16275,
198,
197,
9859,
2662,
1465,
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... | 4 |
func TestTrim(t *testing.T) {
table := []struct {
in string
out string
}{
{
in: "1234567890",
out: "12345678",
},
{
in: "1234",
out: "1234",
},
}
for i, r := range table {
out := TrimSHA(r.in)
if out != r.out {
t.Fatalf("[%d] expected %s, got %s", i, r.out, out)
}
}
} | explode_data.jsonl/68096 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 168
} | [
2830,
3393,
25656,
1155,
353,
8840,
836,
8,
341,
26481,
1669,
3056,
1235,
341,
197,
17430,
220,
914,
198,
197,
13967,
914,
198,
197,
59403,
197,
197,
515,
298,
17430,
25,
220,
330,
16,
17,
18,
19,
20,
21,
22,
23,
24,
15,
756,
29... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestAccResourceHelmService_DeleteUnderlyingResource(t *testing.T) {
var (
name = fmt.Sprintf("%s_%s", t.Name(), utils.RandStringBytes(12))
description = "some description"
resourceName = "harness_service_helm.test"
serviceId = ""
appId = ""
)
resource.UnitTest(t, resource.TestCase{
PreCheck: func() { acctest.TestAccPreCheck(t) },
ProviderFactories: acctest.ProviderFactories,
Steps: []resource.TestStep{
{
Config: testAccResourceHelmService(name, description),
Check: resource.ComposeTestCheckFunc(
resource.TestCheckResourceAttr(resourceName, "name", name),
func(state *terraform.State) error {
svc, _ := testAccGetService(resourceName, state)
serviceId = svc.Id
appId = svc.ApplicationId
return nil
},
),
},
{
PreConfig: func() {
acctest.TestAccConfigureProvider()
c := acctest.TestAccProvider.Meta().(*internal.Session)
svc, err := c.CDClient.ConfigAsCodeClient.GetServiceById(appId, serviceId)
require.NoError(t, err)
require.NotNil(t, svc)
err = c.CDClient.ConfigAsCodeClient.DeleteService(svc.ApplicationId, svc.Id)
require.NoError(t, err)
},
Config: testAccResourceHelmService(name, description),
PlanOnly: true,
ExpectNonEmptyPlan: true,
},
},
})
} | explode_data.jsonl/78900 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 590
} | [
2830,
3393,
14603,
4783,
39,
23162,
1860,
57418,
16250,
6711,
4783,
1155,
353,
8840,
836,
8,
1476,
2405,
2399,
197,
11609,
260,
284,
8879,
17305,
4430,
82,
18695,
82,
497,
259,
2967,
1507,
12439,
2013,
437,
703,
7078,
7,
16,
17,
1171,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestAppBlockSettings(t *testing.T) {
dbfile := tests.Tempfile()
defer os.Remove(dbfile)
os.Setenv("HEKETI_EXECUTOR", "mock")
defer os.Unsetenv("HEKETI_EXECUTOR")
os.Setenv("HEKETI_DB_PATH", dbfile)
defer os.Unsetenv("HEKETI_DB_PATH")
conf := &GlusterFSConfig{
Executor: "crazyexec",
Allocator: "simple",
DBfile: "/path/to/nonexistent/heketi.db",
CreateBlockHostingVolumes: true,
BlockHostingVolumeSize: 500,
}
blockauto, blocksize := CreateBlockHostingVolumes, BlockHostingVolumeSize
defer func() {
CreateBlockHostingVolumes, BlockHostingVolumeSize = blockauto, blocksize
}()
app := NewApp(conf)
defer app.Close()
tests.Assert(t, app != nil)
tests.Assert(t, app.conf.Executor == "mock")
tests.Assert(t, app.conf.DBfile == dbfile)
tests.Assert(t, CreateBlockHostingVolumes == true)
tests.Assert(t, BlockHostingVolumeSize == 500)
} | explode_data.jsonl/51873 | {
"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,
2164,
4713,
6086,
1155,
353,
8840,
836,
8,
1476,
20939,
1192,
1669,
7032,
65009,
1192,
741,
16867,
2643,
13270,
9791,
1192,
340,
25078,
4202,
3160,
445,
1799,
42,
1348,
40,
38235,
83321,
497,
330,
16712,
1138,
16867,
2643,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestNewDNSProvider(t *testing.T) {
testCases := []struct {
desc string
envVars map[string]string
expected string
}{
{
desc: "success",
envVars: map[string]string{
"DO_AUTH_TOKEN": "123",
},
},
{
desc: "missing credentials",
envVars: map[string]string{
"DO_AUTH_TOKEN": "",
},
expected: "digitalocean: some credentials information are missing: DO_AUTH_TOKEN",
},
}
for _, test := range testCases {
t.Run(test.desc, func(t *testing.T) {
defer envTest.RestoreEnv()
envTest.ClearEnv()
envTest.Apply(test.envVars)
p, err := NewDNSProvider()
if len(test.expected) == 0 {
require.NoError(t, err)
require.NotNil(t, p)
require.NotNil(t, p.config)
require.NotNil(t, p.recordIDs)
} else {
require.EqualError(t, err, test.expected)
}
})
}
} | explode_data.jsonl/81803 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 389
} | [
2830,
3393,
3564,
61088,
5179,
1155,
353,
8840,
836,
8,
341,
18185,
37302,
1669,
3056,
1235,
341,
197,
41653,
257,
914,
198,
197,
57538,
28305,
220,
2415,
14032,
30953,
198,
197,
42400,
914,
198,
197,
59403,
197,
197,
515,
298,
41653,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestOperatorSyncClusterAPIControllerHealthCheckController(t *testing.T) {
tests := []struct {
featureGate *v1.FeatureGate
expectedMachineHealthCheckController bool
}{{
featureGate: newFeatureGate(v1.Default),
expectedMachineHealthCheckController: false,
}, {
featureGate: &v1.FeatureGate{},
expectedMachineHealthCheckController: false,
}, {
featureGate: newFeatureGate(v1.TechPreviewNoUpgrade),
expectedMachineHealthCheckController: true,
}}
for _, tc := range tests {
infra := &v1.Infrastructure{
ObjectMeta: metav1.ObjectMeta{
Name: "cluster",
},
Status: v1.InfrastructureStatus{
Platform: v1.AWSPlatformType,
},
}
stopCh := make(<-chan struct{})
optr := newFakeOperator(nil, []runtime.Object{tc.featureGate, infra}, stopCh)
go optr.Run(2, stopCh)
if err := wait.PollImmediate(1*time.Second, 5*time.Second, func() (bool, error) {
d, err := optr.deployLister.Deployments(targetNamespace).Get(deploymentName)
if err != nil {
t.Logf("Failed to get %q deployment: %v", deploymentName, err)
return false, nil
}
if deploymentHasContainer(d, hcControllerName) != tc.expectedMachineHealthCheckController {
t.Logf("Expected deploymentHasContainer for %q container to be %t", hcControllerName, tc.expectedMachineHealthCheckController)
return false, nil
}
return true, nil
}); err != nil {
t.Errorf("Failed to verify %q deployment", deploymentName)
}
}
} | explode_data.jsonl/16340 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 623
} | [
2830,
3393,
18461,
12154,
28678,
7082,
2051,
14542,
3973,
2051,
1155,
353,
8840,
836,
8,
341,
78216,
1669,
3056,
1235,
341,
197,
1166,
15208,
42318,
3502,
353,
85,
16,
58434,
42318,
198,
197,
42400,
21605,
14542,
3973,
2051,
1807,
198,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
func TestCronCatchedCCExpirationsAtDeadlineBoundary(t *testing.T) {
ctx := context.Background()
v := vm.NewVMWithSingletons(ctx, t)
addrs := vm.CreateAccounts(ctx, t, v, 2, big.Mul(big.NewInt(10_000), vm.FIL), 93837778)
worker, unverifiedClient := addrs[0], addrs[1]
minerBalance := big.Mul(big.NewInt(1_000), vm.FIL)
sectorNumber := abi.SectorNumber(100)
sealedCid := tutil.MakeCID("100", &miner.SealedCIDPrefix)
sealProof := abi.RegisteredSealProof_StackedDrg32GiBV1
// create miner
params := power.CreateMinerParams{
Owner: worker,
Worker: worker,
SealProofType: sealProof,
Peer: abi.PeerID("not really a peer id"),
}
ret := vm.ApplyOk(t, v, worker, builtin.StoragePowerActorAddr, minerBalance, builtin.MethodsPower.CreateMiner, ¶ms)
minerAddrs, ok := ret.(*power.CreateMinerReturn)
require.True(t, ok)
// precommit sector
preCommitParams := miner.PreCommitSectorParams{
SealProof: sealProof,
SectorNumber: sectorNumber,
SealedCID: sealedCid,
SealRandEpoch: v.GetEpoch() - 1,
DealIDs: nil,
Expiration: v.GetEpoch() + 200*builtin.EpochsInDay,
}
vm.ApplyOk(t, v, addrs[0], minerAddrs.RobustAddress, big.Zero(), builtin.MethodsMiner.PreCommitSector, &preCommitParams)
// advance time to max seal duration
proveTime := v.GetEpoch() + miner.PreCommitChallengeDelay + 1
v, _ = vm.AdvanceByDeadlineTillEpoch(t, v, minerAddrs.IDAddress, proveTime)
// Prove commit sector after max seal duration
v, err := v.WithEpoch(proveTime)
require.NoError(t, err)
proveCommitParams := miner.ProveCommitSectorParams{
SectorNumber: sectorNumber,
}
vm.ApplyOk(t, v, worker, minerAddrs.RobustAddress, big.Zero(), builtin.MethodsMiner.ProveCommitSector, &proveCommitParams)
// In the same epoch, trigger cron to validate prove commit
vm.ApplyOk(t, v, builtin.SystemActorAddr, builtin.CronActorAddr, big.Zero(), builtin.MethodsCron.EpochTick, nil)
// advance to proving period and submit post
dlInfo, pIdx, v := vm.AdvanceTillProvingDeadline(t, v, minerAddrs.IDAddress, sectorNumber)
submitParams := miner.SubmitWindowedPoStParams{
Deadline: dlInfo.Index,
Partitions: []miner.PoStPartition{{
Index: pIdx,
Skipped: bitfield.New(),
}},
Proofs: []proof.PoStProof{{
PoStProof: abi.RegisteredPoStProof_StackedDrgWindow32GiBV1,
}},
ChainCommitEpoch: dlInfo.Challenge,
ChainCommitRand: fakeChainRandomness,
}
vm.ApplyOk(t, v, addrs[0], minerAddrs.RobustAddress, big.Zero(), builtin.MethodsMiner.SubmitWindowedPoSt, &submitParams)
// add market collateral for client and miner
collateral := big.Mul(big.NewInt(3), vm.FIL)
vm.ApplyOk(t, v, unverifiedClient, builtin.StorageMarketActorAddr, collateral, builtin.MethodsMarket.AddBalance, &unverifiedClient)
collateral = big.Mul(big.NewInt(64), vm.FIL)
vm.ApplyOk(t, v, worker, builtin.StorageMarketActorAddr, collateral, builtin.MethodsMarket.AddBalance, &minerAddrs.IDAddress)
// create a deal required by upgrade sector
dealIDs := []abi.DealID{}
dealStart := v.GetEpoch() + miner.MaxProveCommitDuration[sealProof]
deals := publishDeal(t, v, worker, unverifiedClient, minerAddrs.IDAddress, "deal1", 1<<30, false, dealStart, 181*builtin.EpochsInDay)
dealIDs = append(dealIDs, deals.IDs...)
// precommit capacity upgrade sector with deals
upgradeSectorNumber := abi.SectorNumber(101)
upgradeSealedCid := tutil.MakeCID("101", &miner.SealedCIDPrefix)
preCommitParams = miner.PreCommitSectorParams{
SealProof: sealProof,
SectorNumber: upgradeSectorNumber,
SealedCID: upgradeSealedCid,
SealRandEpoch: v.GetEpoch() - 1,
DealIDs: dealIDs,
Expiration: v.GetEpoch() + 220*builtin.EpochsInDay,
ReplaceCapacity: true,
ReplaceSectorDeadline: dlInfo.Index,
ReplaceSectorPartition: pIdx,
ReplaceSectorNumber: sectorNumber,
}
vm.ApplyOk(t, v, addrs[0], minerAddrs.RobustAddress, big.Zero(), builtin.MethodsMiner.PreCommitSector, &preCommitParams)
// Advance to beginning of the valid prove-commit window, then advance to proving deadline of original sector.
// This should allow us to prove commit the upgrade on the last epoch of the original sector's proving period.
proveTime = v.GetEpoch() + miner.PreCommitChallengeDelay + 1
v, _ = vm.AdvanceByDeadlineTillEpoch(t, v, minerAddrs.IDAddress, proveTime)
dlInfo, _, v = vm.AdvanceTillProvingDeadline(t, v, minerAddrs.IDAddress, sectorNumber)
// prove original sector so it won't be faulted
submitParams.ChainCommitEpoch = dlInfo.Challenge
vm.ApplyOk(t, v, addrs[0], minerAddrs.RobustAddress, big.Zero(), builtin.MethodsMiner.SubmitWindowedPoSt, &submitParams)
// one epoch before deadline close (i.e. Last) is where we might see a problem with cron scheduling of expirations
v, err = v.WithEpoch(dlInfo.Last())
require.NoError(t, err)
// miner still has power for old sector
sectorPower := vm.PowerForMinerSector(t, v, minerAddrs.IDAddress, sectorNumber)
minerPower := vm.MinerPower(t, v, minerAddrs.IDAddress)
assert.Equal(t, sectorPower.Raw, minerPower.Raw)
assert.Equal(t, sectorPower.QA, minerPower.QA)
// Prove commit sector after max seal duration
proveCommitParams = miner.ProveCommitSectorParams{
SectorNumber: upgradeSectorNumber,
}
vm.ApplyOk(t, v, worker, minerAddrs.RobustAddress, big.Zero(), builtin.MethodsMiner.ProveCommitSector, &proveCommitParams)
// In the same epoch, trigger cron to validate prove commit
// Replaced sector should be terminated at end of deadline it was replace in, so it should be terminated
// by this call. This requires the miner's proving period handling to be run after commit verification.
vm.ApplyOk(t, v, builtin.SystemActorAddr, builtin.CronActorAddr, big.Zero(), builtin.MethodsCron.EpochTick, nil)
// Loss of power indicates original sector has been terminated at correct time.
minerPower = vm.MinerPower(t, v, minerAddrs.IDAddress)
assert.Equal(t, big.Zero(), minerPower.Raw)
assert.Equal(t, big.Zero(), minerPower.QA)
} | explode_data.jsonl/65963 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 2412
} | [
2830,
3393,
34,
2248,
34,
34244,
3706,
840,
5565,
804,
1655,
83593,
57977,
1155,
353,
8840,
836,
8,
972,
20985,
1669,
2266,
19047,
3568,
5195,
1669,
10995,
7121,
11187,
2354,
25915,
82,
7502,
11,
259,
1218,
12718,
5428,
1669,
10995,
725... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestDiff(t *testing.T) {
var tests []test
tests = append(tests, comparerTests()...)
tests = append(tests, transformerTests()...)
tests = append(tests, reporterTests()...)
tests = append(tests, embeddedTests()...)
tests = append(tests, methodTests()...)
tests = append(tests, cycleTests()...)
tests = append(tests, project1Tests()...)
tests = append(tests, project2Tests()...)
tests = append(tests, project3Tests()...)
tests = append(tests, project4Tests()...)
const goldenFile = "testdata/diffs"
gotDiffs := []struct{ Name, Data string }{}
wantDiffs := mustParseGolden(goldenFile)
for _, tt := range tests {
tt := tt
t.Run(tt.label, func(t *testing.T) {
if !*update {
t.Parallel()
}
var gotDiff, gotPanic string
func() {
defer func() {
if ex := recover(); ex != nil {
if s, ok := ex.(string); ok {
gotPanic = s
} else {
panic(ex)
}
}
}()
gotDiff = cmp.Diff(tt.x, tt.y, tt.opts...)
}()
switch {
case strings.Contains(t.Name(), "#"):
panic("unique test name must be provided")
case tt.reason == "":
panic("reason must be provided")
case tt.wantPanic == "":
if gotPanic != "" {
t.Fatalf("unexpected panic message: %s\nreason: %v", gotPanic, tt.reason)
}
if *update {
if gotDiff != "" {
gotDiffs = append(gotDiffs, struct{ Name, Data string }{t.Name(), gotDiff})
}
} else {
wantDiff := wantDiffs[t.Name()]
if diff := cmp.Diff(wantDiff, gotDiff); diff != "" {
t.Fatalf("Diff:\ngot:\n%s\nwant:\n%s\ndiff: (-want +got)\n%s\nreason: %v", gotDiff, wantDiff, diff, tt.reason)
}
}
gotEqual := gotDiff == ""
if gotEqual != tt.wantEqual {
t.Fatalf("Equal = %v, want %v\nreason: %v", gotEqual, tt.wantEqual, tt.reason)
}
default:
if !strings.Contains(gotPanic, tt.wantPanic) {
t.Fatalf("panic message:\ngot: %s\nwant: %s\nreason: %v", gotPanic, tt.wantPanic, tt.reason)
}
}
})
}
if *update {
mustFormatGolden(goldenFile, gotDiffs)
}
} | explode_data.jsonl/25288 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 922
} | [
2830,
3393,
21751,
1155,
353,
8840,
836,
8,
341,
2405,
7032,
3056,
1944,
198,
78216,
284,
8737,
8623,
82,
11,
92355,
18200,
368,
31218,
78216,
284,
8737,
8623,
82,
11,
42578,
18200,
368,
31218,
78216,
284,
8737,
8623,
82,
11,
18960,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestEmojiToASCII(t *testing.T) {
conv := NewConverter()
for _, tt := range emoji2ASCIITests {
gotASCII := conv.ConvertShortcodesString(tt.v, ASCII)
if gotASCII != tt.wantASCII {
t.Errorf("converter.ConvertString(\"%v\", ASCII) Mismatch: want [%v] got [%v]", tt.v, tt.wantASCII, gotASCII)
}
gotUnicode := conv.ConvertShortcodesString(tt.v, Unicode)
if gotUnicode != tt.wantUnicode {
t.Errorf("converter.ConvertString(\"%v\", Unicode) Mismatch: want [%v] got [%v]", tt.v, tt.wantUnicode, gotUnicode)
}
}
} | explode_data.jsonl/53354 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 239
} | [
2830,
3393,
92731,
1249,
56450,
1155,
353,
8840,
836,
8,
341,
197,
12027,
1669,
1532,
14920,
741,
2023,
8358,
17853,
1669,
2088,
42365,
17,
1911,
11237,
952,
17966,
341,
197,
3174,
354,
56450,
1669,
5686,
36179,
12472,
25814,
703,
47152,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestHasOneOverrideForeignKey1(t *testing.T) {
type Profile struct {
orm.Model
Name string
UserRefer uint
}
type User struct {
orm.Model
Profile Profile `orm:"ForeignKey:UserRefer"`
}
if relation, ok := DB.NewScope(&User{}).FieldByName("Profile"); ok {
if relation.Relationship.Kind != "has_one" ||
!reflect.DeepEqual(relation.Relationship.ForeignFieldNames, []string{"UserRefer"}) ||
!reflect.DeepEqual(relation.Relationship.AssociationForeignFieldNames, []string{"ID"}) {
t.Errorf("Override belongs to foreign key with tag")
}
}
} | explode_data.jsonl/15879 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 201
} | [
2830,
3393,
10281,
3966,
2177,
28445,
16,
1155,
353,
8840,
836,
8,
341,
13158,
12329,
2036,
341,
197,
197,
493,
5659,
198,
197,
21297,
414,
914,
198,
197,
31672,
47447,
2622,
198,
197,
630,
13158,
2657,
2036,
341,
197,
197,
493,
5659,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 5 |
func Test_diffManager_GetChangedFiles_CommitDiff_Gitlab(t *testing.T) {
data, err := testutils.GetGitlabCommitDiff()
if err != nil {
t.Errorf("Received error in getting test gitlab commit diff, error: %v", err)
}
server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
if r.URL.Path != "/testdata/repository/compare" {
t.Errorf("Expected to request, got: %v", r.URL.Path)
}
w.WriteHeader(200)
w.Header().Set("Content-Type", "application/json")
_, err2 := w.Write(data)
if err2 != nil {
t.Errorf("Error in writing response data, error: %v", err)
}
}))
defer server.Close()
logger, err := testutils.GetLogger()
if err != nil {
t.Errorf("Can't get logger, received: %s", err)
}
config, err := testutils.GetConfig()
if err != nil {
t.Errorf("Can't get logger, received: %s", err)
}
dm := NewDiffManager(config, logger)
type args struct {
ctx context.Context
payload *core.Payload
oauth *core.Oauth
}
tests := []struct {
name string
args args
want map[string]int
}{
// expects to hit serverURL/testdata/repository/compare?from=abc&to=abcd
{"Test GetChangedFile for CommitDiff for gitlab gitprovider",
args{ctx: context.TODO(),
payload: &core.Payload{RepoSlug: "/testdata", RepoLink: server.URL + "/testdata",
BuildTargetCommit: "abcd", BuildBaseCommit: "abc", TaskID: "taskid", BranchName: "branchname", BuildID: "buildid", RepoID: "repoid",
OrgID: "orgid", GitProvider: "gitlab", PrivateRepo: false, EventType: "push", Diff: "xyz", PullRequestNumber: 2},
oauth: &core.Oauth{}}, map[string]int{}},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
global.APIHostURLMap[tt.args.payload.GitProvider] = server.URL
resp, err := dm.GetChangedFiles(tt.args.ctx, tt.args.payload, tt.args.oauth)
if err != nil {
t.Errorf("error in getting changed files, error %v", err.Error())
} else if len(resp) != 202 {
t.Errorf("Expected map length: 202, received: %v\nreceived map: %v", len(resp), resp)
}
})
}
} | explode_data.jsonl/12411 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 829
} | [
2830,
3393,
15850,
2043,
13614,
5389,
10809,
16946,
1763,
21751,
2646,
275,
14380,
1155,
353,
8840,
836,
8,
341,
8924,
11,
1848,
1669,
1273,
6031,
2234,
46562,
14380,
33441,
21751,
741,
743,
1848,
961,
2092,
341,
197,
3244,
13080,
445,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
func TestSHA256Sums_OutputsCorrectHashForEachSpecifiedFile(t *testing.T) {
t.Parallel()
tcs := []struct {
testFileName string
want string
}{
// To get the checksum run: openssl dgst -sha256 <file_name>
{"testdata/sha256Sum.input.txt", "1870478d23b0b4db37735d917f4f0ff9393dd3e52d8b0efa852ab85536ddad8e\n"},
{"testdata/hello.txt", "b94d27b9934d3e08a52e52d7da7dabfac484efe37a5380ee9088f7ace2efcde9\n"},
{"testdata/multiple_files", "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855\ne3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855\ne3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855\n"},
}
for _, tc := range tcs {
got, err := script.ListFiles(tc.testFileName).SHA256Sums().String()
if err != nil {
t.Error(err)
}
if got != tc.want {
t.Errorf("%q: want %q, got %q", tc.testFileName, tc.want, got)
}
}
} | explode_data.jsonl/51500 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 443
} | [
2830,
3393,
33145,
17,
20,
21,
50,
6237,
36675,
16920,
33092,
6370,
91392,
8327,
1870,
1703,
1155,
353,
8840,
836,
8,
341,
3244,
41288,
7957,
741,
3244,
4837,
1669,
3056,
1235,
341,
197,
18185,
10903,
914,
198,
197,
50780,
260,
914,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestGetAbortScaleDownDelaySecondsOrDefault(t *testing.T) {
{
abortScaleDownDelaySeconds := int32(60)
blueGreenNonDefaultValue := &v1alpha1.Rollout{
Spec: v1alpha1.RolloutSpec{
Strategy: v1alpha1.RolloutStrategy{
BlueGreen: &v1alpha1.BlueGreenStrategy{
AbortScaleDownDelaySeconds: &abortScaleDownDelaySeconds,
},
},
},
}
assert.Equal(t, time.Duration(abortScaleDownDelaySeconds)*time.Second, *GetAbortScaleDownDelaySecondsOrDefault(blueGreenNonDefaultValue))
}
{
// dont scale down preview
abortScaleDownDelaySeconds := int32(0)
blueGreenZeroValue := &v1alpha1.Rollout{
Spec: v1alpha1.RolloutSpec{
Strategy: v1alpha1.RolloutStrategy{
BlueGreen: &v1alpha1.BlueGreenStrategy{
AbortScaleDownDelaySeconds: &abortScaleDownDelaySeconds,
},
},
},
}
assert.Nil(t, GetAbortScaleDownDelaySecondsOrDefault(blueGreenZeroValue))
}
{
blueGreenDefaultValue := &v1alpha1.Rollout{
Spec: v1alpha1.RolloutSpec{
Strategy: v1alpha1.RolloutStrategy{
BlueGreen: &v1alpha1.BlueGreenStrategy{},
},
},
}
assert.Equal(t, time.Duration(DefaultAbortScaleDownDelaySeconds)*time.Second, *GetAbortScaleDownDelaySecondsOrDefault(blueGreenDefaultValue))
}
{
abortScaleDownDelaySeconds := int32(60)
canaryNonDefaultValue := &v1alpha1.Rollout{
Spec: v1alpha1.RolloutSpec{
Strategy: v1alpha1.RolloutStrategy{
Canary: &v1alpha1.CanaryStrategy{
AbortScaleDownDelaySeconds: &abortScaleDownDelaySeconds,
TrafficRouting: &v1alpha1.RolloutTrafficRouting{},
},
},
},
}
assert.Equal(t, time.Duration(abortScaleDownDelaySeconds)*time.Second, *GetAbortScaleDownDelaySecondsOrDefault(canaryNonDefaultValue))
}
{
// dont scale down canary
abortScaleDownDelaySeconds := int32(0)
canaryZeroValue := &v1alpha1.Rollout{
Spec: v1alpha1.RolloutSpec{
Strategy: v1alpha1.RolloutStrategy{
Canary: &v1alpha1.CanaryStrategy{
AbortScaleDownDelaySeconds: &abortScaleDownDelaySeconds,
TrafficRouting: &v1alpha1.RolloutTrafficRouting{},
},
},
},
}
assert.Nil(t, GetAbortScaleDownDelaySecondsOrDefault(canaryZeroValue))
}
{
rolloutNoStrategyDefaultValue := &v1alpha1.Rollout{}
assert.Equal(t, time.Duration(0), *GetAbortScaleDownDelaySecondsOrDefault(rolloutNoStrategyDefaultValue))
}
{
canaryDefaultValue := &v1alpha1.Rollout{
Spec: v1alpha1.RolloutSpec{
Strategy: v1alpha1.RolloutStrategy{
Canary: &v1alpha1.CanaryStrategy{
TrafficRouting: &v1alpha1.RolloutTrafficRouting{},
},
},
},
}
assert.Equal(t, time.Duration(DefaultAbortScaleDownDelaySeconds)*time.Second, *GetAbortScaleDownDelaySecondsOrDefault(canaryDefaultValue))
}
{
// basic canary should not have scaledown delay seconds
canaryDefaultValue := &v1alpha1.Rollout{
Spec: v1alpha1.RolloutSpec{
Strategy: v1alpha1.RolloutStrategy{
Canary: &v1alpha1.CanaryStrategy{},
},
},
}
assert.Equal(t, time.Duration(0), *GetAbortScaleDownDelaySecondsOrDefault(canaryDefaultValue))
}
} | explode_data.jsonl/15134 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 1341
} | [
2830,
3393,
1949,
85891,
6947,
4454,
20039,
15343,
14188,
1155,
353,
8840,
836,
8,
341,
197,
515,
197,
197,
46699,
6947,
4454,
20039,
15343,
1669,
526,
18,
17,
7,
21,
15,
340,
197,
197,
12203,
19576,
8121,
41533,
1669,
609,
85,
16,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestInterpreterPrecedence(t *testing.T) {
s, err := parseFile("src/parse/asp/test_data/interpreter/precedence.build")
require.NoError(t, err)
assert.EqualValues(t, pyList{pyString("a.go")}, s.Lookup("file_srcs"))
} | explode_data.jsonl/81068 | {
"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,
58426,
4703,
1998,
763,
1155,
353,
8840,
836,
8,
341,
1903,
11,
1848,
1669,
4715,
1703,
445,
3548,
14,
6400,
14,
13367,
12697,
1769,
14,
90554,
14,
26152,
763,
13239,
1138,
17957,
35699,
1155,
11,
1848,
340,
6948,
12808,
6... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
func TestRejectInvalidQueries(t *testing.T) {
queries := []string{"key=", "key=value"}
cfg := &packages.Config{
Mode: packages.LoadImports,
Env: append(os.Environ(), "GO111MODULE=off"),
}
for _, q := range queries {
if _, err := packages.Load(cfg, q); err == nil {
t.Errorf("packages.Load(%q) succeeded. Expected \"invalid query type\" error", q)
} else if !strings.Contains(err.Error(), "invalid query type") {
t.Errorf("packages.Load(%q): got error %v, want \"invalid query type\" error", q, err)
}
}
} | explode_data.jsonl/45201 | {
"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,
78413,
7928,
55261,
1155,
353,
8840,
836,
8,
341,
197,
42835,
1669,
3056,
917,
4913,
792,
21369,
330,
792,
46538,
16707,
50286,
1669,
609,
43141,
10753,
515,
197,
197,
3636,
25,
14185,
13969,
31250,
345,
197,
197,
14359,
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 TestArrayJobToBatchInput(t *testing.T) {
expectedBatchInput := &batch.SubmitJobInput{
ArrayProperties: &batch.ArrayProperties{
Size: refInt(10),
},
JobDefinition: refStr(""),
JobName: refStr("Job_Name"),
JobQueue: refStr("child_queue"),
ContainerOverrides: &batch.ContainerOverrides{
Command: []*string{ref("cmd"), ref("/inputs/prefix")},
Environment: []*batch.KeyValuePair{
{Name: refStr("BATCH_JOB_ARRAY_INDEX_VAR_NAME"), Value: refStr("AWS_BATCH_JOB_ARRAY_INDEX")},
},
Memory: refInt(1074),
Vcpus: refInt(1),
},
}
input := &plugins.ArrayJob{
Size: 10,
Parallelism: 5,
}
id := &mocks.TaskExecutionID{}
id.OnGetGeneratedName().Return("Job_Name")
id.OnGetID().Return(core.TaskExecutionIdentifier{})
to := &mocks.TaskOverrides{}
to.OnGetConfig().Return(&v12.ConfigMap{
Data: map[string]string{
DynamicTaskQueueKey: "child_queue",
},
})
to.OnGetResources().Return(&v12.ResourceRequirements{
Limits: v12.ResourceList{},
Requests: v12.ResourceList{},
})
tMetadata := &mocks.TaskExecutionMetadata{}
tMetadata.OnGetAnnotations().Return(map[string]string{"aKey": "aVal"})
tMetadata.OnGetNamespace().Return("ns")
tMetadata.OnGetLabels().Return(map[string]string{"lKey": "lVal"})
tMetadata.OnGetOwnerReference().Return(v1.OwnerReference{Name: "x"})
tMetadata.OnGetTaskExecutionID().Return(id)
tMetadata.OnGetOverrides().Return(to)
tMetadata.OnGetPlatformResources().Return(&v12.ResourceRequirements{})
ir := &mocks2.InputReader{}
ir.OnGetInputPath().Return("inputs.pb")
ir.OnGetInputPrefixPath().Return("/inputs/prefix")
ir.OnGetMatch(mock.Anything).Return(nil, nil)
or := &mocks2.OutputWriter{}
or.OnGetOutputPrefixPath().Return("/path/output")
or.OnGetRawOutputPrefix().Return("s3://")
or.OnGetCheckpointPrefix().Return("/checkpoint")
or.OnGetPreviousCheckpointsPrefix().Return("/prev")
taskCtx := &mocks.TaskExecutionContext{}
taskCtx.OnTaskExecutionMetadata().Return(tMetadata)
taskCtx.OnInputReader().Return(ir)
taskCtx.OnOutputWriter().Return(or)
st, err := utils.MarshalObjToStruct(input)
assert.NoError(t, err)
taskTemplate := &core.TaskTemplate{
Id: &core.Identifier{Name: "Job_Name"},
Custom: st,
Target: &core.TaskTemplate_Container{
Container: createSampleContainerTask(),
},
}
tr := &mocks.TaskReader{}
tr.OnReadMatch(mock.Anything).Return(taskTemplate, nil)
taskCtx.OnTaskReader().Return(tr)
ctx := context.Background()
batchInput, err := FlyteTaskToBatchInput(ctx, taskCtx, "", &config.Config{})
assert.NoError(t, err)
batchInput = UpdateBatchInputForArray(ctx, batchInput, input.Size)
assert.NotNil(t, batchInput)
assert.Equal(t, *expectedBatchInput, *batchInput)
} | explode_data.jsonl/20422 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 1065
} | [
2830,
3393,
1857,
12245,
1249,
21074,
2505,
1155,
353,
8840,
836,
8,
341,
42400,
21074,
2505,
1669,
609,
14049,
98309,
12245,
2505,
515,
197,
58743,
7903,
25,
609,
14049,
8114,
7903,
515,
298,
91224,
25,
2053,
1072,
7,
16,
15,
1326,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func Test_CLG_GetCalculate(t *testing.T) {
newCLG := MustNew()
if reflect.TypeOf(newCLG.GetCalculate()).Kind() != reflect.Func {
t.Fatal("expected", false, "got", true)
}
} | explode_data.jsonl/66655 | {
"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,
6843,
38,
13614,
47866,
1155,
353,
8840,
836,
8,
341,
8638,
3140,
38,
1669,
15465,
3564,
741,
743,
8708,
73921,
1755,
3140,
38,
2234,
47866,
6011,
10629,
368,
961,
8708,
69845,
341,
197,
3244,
26133,
445,
7325,
497,
895,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestMonitorProxy_Do(t *testing.T) {
poolOnce = sync.Once{}
redisClientOptions := ClientOptions{}
memConfig := config.NewMemConfig()
memConfig.Set("debug", true)
redisClent := NewClient(
redisClientOptions.WithConf(memConfig),
redisClientOptions.WithProxy(
func() interface{} {
monitorProxyOptions := MonitorProxyOptions{}
return NewMonitorProxy(
monitorProxyOptions.WithLogger(log.NewLogger()),
)
},
),
)
ctx := context.Background()
conn := redisClent.GetCtxRedisConn()
_, err := String(conn.Do(ctx, "get", "name"))
assert.Nil(t, err)
err = conn.Close()
assert.Nil(t, err)
err = redisClent.Close()
assert.Nil(t, err)
} | explode_data.jsonl/59704 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 263
} | [
2830,
3393,
30098,
16219,
93481,
1155,
353,
8840,
836,
8,
341,
85273,
12522,
284,
12811,
77946,
16094,
197,
21748,
2959,
3798,
1669,
8423,
3798,
16094,
14145,
2648,
1669,
2193,
7121,
18816,
2648,
741,
14145,
2648,
4202,
445,
8349,
497,
83... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestInsertValuePgxSQL(t *testing.T) {
db, cleanup := testCreateDB(t, 3)
defer cleanup()
tm := pgx.NullTime{
Valid: false,
}
if err := insertValuePgxSQL(db.DB, tm); err != nil {
t.Fatal(err)
}
if driver, ok := db.Driver().(*stdlib.Driver); ok && driver.Pool != nil {
rows, err := driver.Pool.Query(`SELECT id, t FROM test`)
if err != nil {
t.Fatal(err)
}
defer rows.Close()
var i int
var ntm pgx.NullTime
for rows.Next() {
err := rows.Scan(&i, &ntm)
if err != nil {
t.Fatal(err)
}
log.Printf("%d %v", i, ntm)
}
}
} | explode_data.jsonl/74276 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 265
} | [
2830,
3393,
13780,
1130,
47,
59957,
6688,
1155,
353,
8840,
836,
8,
341,
20939,
11,
21290,
1669,
1273,
4021,
3506,
1155,
11,
220,
18,
340,
16867,
21290,
2822,
3244,
76,
1669,
17495,
87,
23979,
1462,
515,
197,
197,
4088,
25,
895,
345,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 7 |
func TestValueAssignment_GetFunction(t *testing.T) {
t.Parallel()
type fields struct {
Type ValueAssignmentType
Value interface{}
}
tests := []struct {
name string
fields fields
want *Function
}{
{"TestGetProp", fields{ValueAssignmentFunction,
&Function{
Operator: GetPropertyOperator,
Operands: []Operand{LiteralOperand("SELF"), LiteralOperand("prop")},
}},
&Function{
Operator: GetPropertyOperator,
Operands: []Operand{LiteralOperand("SELF"), LiteralOperand("prop")},
},
},
{"TestConcat", fields{ValueAssignmentFunction,
&Function{
Operator: ConcatOperator,
Operands: []Operand{
&Function{
Operator: GetPropertyOperator,
Operands: []Operand{LiteralOperand("SELF"), LiteralOperand("prop")},
},
LiteralOperand(":"),
},
}},
&Function{
Operator: ConcatOperator,
Operands: []Operand{
&Function{
Operator: GetPropertyOperator,
Operands: []Operand{LiteralOperand("SELF"), LiteralOperand("prop")},
},
LiteralOperand(":"),
},
},
},
{"TestFunction", fields{ValueAssignmentFunction, nil}, nil},
{"TestLiteral", fields{ValueAssignmentLiteral, "ko"}, nil},
{"TestList", fields{ValueAssignmentList, []string{"1", "2", "3"}}, nil},
{"TestMap", fields{ValueAssignmentMap, map[string]string{"1": "one", "2": "two", "3": "three"}}, nil},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
p := ValueAssignment{
Type: tt.fields.Type,
Value: tt.fields.Value,
}
if got := p.GetFunction(); !reflect.DeepEqual(got, tt.want) {
t.Errorf("ValueAssignment.GetFunction() = %v, want %v", got, tt.want)
}
})
}
} | explode_data.jsonl/64261 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 724
} | [
2830,
3393,
1130,
41613,
13614,
5152,
1155,
353,
8840,
836,
8,
341,
3244,
41288,
7957,
741,
13158,
5043,
2036,
341,
197,
27725,
220,
5162,
41613,
929,
198,
197,
47399,
3749,
16094,
197,
532,
78216,
1669,
3056,
1235,
341,
197,
11609,
256... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
func TestExtractFile(t *testing.T) {
type tc struct {
name string
hdrs []*tar.Header
contents []byte
checkers []checker
}
tcs := []tc{
{
name: "normal file",
contents: []byte("helloworld"),
hdrs: []*tar.Header{fileHeader("./bar", "helloworld", 0644)},
checkers: []checker{
fileExists("/bar"),
fileMatches("/bar", []byte("helloworld")),
permissionsMatch("/bar", 0644),
},
},
{
name: "normal file, directory does not exist",
contents: []byte("helloworld"),
hdrs: []*tar.Header{fileHeader("./foo/bar", "helloworld", 0644)},
checkers: []checker{
fileExists("/foo/bar"),
fileMatches("/foo/bar", []byte("helloworld")),
permissionsMatch("/foo/bar", 0644),
permissionsMatch("/foo", 0755|os.ModeDir),
},
},
{
name: "normal file, directory is created after",
contents: []byte("helloworld"),
hdrs: []*tar.Header{
fileHeader("./foo/bar", "helloworld", 0644),
dirHeader("./foo", 0722),
},
checkers: []checker{
fileExists("/foo/bar"),
fileMatches("/foo/bar", []byte("helloworld")),
permissionsMatch("/foo/bar", 0644),
permissionsMatch("/foo", 0722|os.ModeDir),
},
},
{
name: "symlink",
hdrs: []*tar.Header{linkHeader("./bar", "bar/bat")},
checkers: []checker{
linkPointsTo("/bar", "bar/bat"),
},
},
{
name: "symlink relative path",
hdrs: []*tar.Header{linkHeader("./bar", "./foo/bar/baz")},
checkers: []checker{
linkPointsTo("/bar", "./foo/bar/baz"),
},
},
{
name: "symlink parent does not exist",
hdrs: []*tar.Header{linkHeader("./foo/bar/baz", "../../bat")},
checkers: []checker{
linkPointsTo("/foo/bar/baz", "../../bat"),
},
},
{
name: "symlink parent does not exist",
hdrs: []*tar.Header{linkHeader("./foo/bar/baz", "../../bat")},
checkers: []checker{
linkPointsTo("/foo/bar/baz", "../../bat"),
permissionsMatch("/foo", 0755|os.ModeDir),
permissionsMatch("/foo/bar", 0755|os.ModeDir),
},
},
{
name: "hardlink",
hdrs: []*tar.Header{
fileHeader("/bin/gzip", "gzip-binary", 0751),
hardlinkHeader("/bin/uncompress", "/bin/gzip"),
},
checkers: []checker{
linkPointsTo("/bin/uncompress", "/bin/gzip"),
},
},
}
for _, tc := range tcs {
t.Run(tc.name, func(t *testing.T) {
tc := tc
t.Parallel()
r, err := ioutil.TempDir("", "")
if err != nil {
t.Fatal(err)
}
defer os.RemoveAll(r)
for _, hdr := range tc.hdrs {
if err := extractFile(r, hdr, bytes.NewReader(tc.contents)); err != nil {
t.Fatal(err)
}
}
for _, checker := range tc.checkers {
checker(r, t)
}
})
}
} | explode_data.jsonl/79684 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 1280
} | [
2830,
3393,
28959,
1703,
1155,
353,
8840,
836,
8,
341,
13158,
17130,
2036,
341,
197,
11609,
257,
914,
198,
197,
9598,
93246,
257,
29838,
26737,
15753,
198,
197,
197,
17610,
3056,
3782,
198,
197,
25157,
388,
3056,
69955,
198,
197,
630,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 5 |
func TestBiggest(t *testing.T) {
tpl := `{{ biggest 1 2 3 345 5 6 7}}`
if err := runt(tpl, `345`); err != nil {
t.Error(err)
}
tpl = `{{ max 345}}`
if err := runt(tpl, `345`); err != nil {
t.Error(err)
}
} | explode_data.jsonl/82259 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 104
} | [
2830,
3393,
15636,
6969,
1155,
353,
8840,
836,
8,
341,
3244,
500,
1669,
1565,
2979,
8538,
220,
16,
220,
17,
220,
18,
220,
18,
19,
20,
220,
20,
220,
21,
220,
22,
3417,
3989,
743,
1848,
1669,
1598,
83,
1155,
500,
11,
1565,
18,
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 TestGetTeamMembers(t *testing.T) {
th := Setup().InitBasic()
defer th.TearDown()
if result, err := th.BasicClient.GetTeamMembers(th.BasicTeam.Id, 0, 100); err != nil {
t.Fatal(err)
} else {
members := result.Data.([]*model.TeamMember)
if len(members) == 0 {
t.Fatal("should have results")
}
}
if _, err := th.BasicClient.GetTeamMembers("junk", 0, 100); err == nil {
t.Fatal("should have errored - bad team id")
}
} | explode_data.jsonl/48515 | {
"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,
1949,
14597,
24371,
1155,
353,
8840,
836,
8,
341,
70479,
1669,
18626,
1005,
3803,
15944,
741,
16867,
270,
836,
682,
4454,
2822,
743,
1102,
11,
1848,
1669,
270,
48868,
2959,
2234,
14597,
24371,
24365,
48868,
14597,
6444,
11,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 4 |
func TestIoBufferWriteUin16(t *testing.T) {
bi := newIoBuffer(1)
b := bi.(*ioBuffer)
input := make([]byte, 0, 1024)
n := randN(512)
var temp [2]byte
for i := 0; i < n; i++ {
err := b.WriteUint16(uint16(i))
if err != nil {
t.Fatal(err)
}
binary.BigEndian.PutUint16(temp[0:], uint16(i))
input = append(input, temp[0])
input = append(input, temp[1])
}
if b.Len() != n*2 {
t.Errorf("Expect %d bytes, but got %d", n, b.Len())
}
if !bytes.Equal(b.Peek(n*2), input) {
t.Errorf("Expect %x, but got %x", input, b.Peek(n))
}
} | explode_data.jsonl/24054 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 268
} | [
2830,
3393,
42799,
4095,
7985,
52,
258,
16,
21,
1155,
353,
8840,
836,
8,
341,
2233,
72,
1669,
501,
42799,
4095,
7,
16,
340,
2233,
1669,
6032,
41399,
815,
4095,
340,
22427,
1669,
1281,
10556,
3782,
11,
220,
15,
11,
220,
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... | 5 |
func TestWhenADOSIsSelectedADOSRepoIsCreated(t *testing.T) {
ctrl := gomock.NewController(t)
defer ctrl.Finish()
mockPrompt := NewMockPrompt(ctrl)
mockPrompt.EXPECT().forGitRepository().Return(constants.ADOS, nil)
factory := NewFactory(mockPrompt)
repo, _ := factory.Create(projectName)
if !isADOSType(repo) {
t.Log("Expected ados type returned")
t.Fail()
return
}
} | explode_data.jsonl/1737 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 156
} | [
2830,
3393,
4498,
89942,
3872,
6316,
89942,
25243,
3872,
11694,
1155,
353,
8840,
836,
8,
341,
84381,
1669,
342,
316,
1176,
7121,
2051,
1155,
340,
16867,
23743,
991,
18176,
2822,
77333,
54615,
1669,
1532,
11571,
54615,
62100,
340,
77333,
5... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
func TestRendersCaseWhen2(t *testing.T) {
template, _ := ParseString("A-{% case 123 %}{% when 'abc' %}when1{% when 1 or 123 %}when2{% else %}else{% endcase%}-Z", nil)
assertRender(t, template, nil, `A-when2-Z`)
} | explode_data.jsonl/42421 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 91
} | [
2830,
3393,
49,
14506,
4207,
4498,
17,
1155,
353,
8840,
836,
8,
341,
22832,
11,
716,
1669,
14775,
703,
445,
32,
63347,
4,
1142,
220,
16,
17,
18,
1018,
15170,
4,
979,
364,
13683,
6,
1018,
92,
9309,
16,
66365,
979,
220,
16,
476,
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 TestFindCommandBinaries(t *testing.T) {
assert := assert.New(t)
f1 := findCommandBinries("/opt", "go")
assert.Equal(f1.Path, "/usr/bin/find")
assert.Equal(f1.Args[1:], []string{"/opt", "-maxdepth", "2", "-iname", "*go*"})
assert.Equal(f1.Env, []string(nil))
} | explode_data.jsonl/33983 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 119
} | [
2830,
3393,
9885,
4062,
28794,
5431,
1155,
353,
8840,
836,
8,
341,
6948,
1669,
2060,
7121,
1155,
340,
1166,
16,
1669,
1477,
4062,
28794,
4019,
4283,
2912,
497,
330,
3346,
1138,
6948,
12808,
955,
16,
17474,
11,
3521,
7063,
8749,
81121,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestWatchMultipleClose(t *testing.T) {
set := New("www", "test", "gotest", []string{TestServer})
watch, err := set.Watch()
if err != nil {
t.Fatal(err)
}
watch.Close()
watch.Close()
watch.Close()
} | explode_data.jsonl/20440 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 84
} | [
2830,
3393,
14247,
32089,
7925,
1155,
353,
8840,
836,
8,
341,
8196,
1669,
1532,
445,
2136,
497,
330,
1944,
497,
330,
22390,
477,
497,
3056,
917,
90,
2271,
5475,
3518,
6692,
754,
11,
1848,
1669,
738,
1175,
754,
741,
743,
1848,
961,
2... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
func Test_getVMExtensionGetHandlerEnvironmentError(t *testing.T) {
ctx := log.NewSyncLogger(log.NewLogfmtLogger(os.Stdout))
myerr := errors.New("cannot handle the environment")
ii, _ := GetInitializationInfo("yaba", "5.0", true, testEnableCallback)
mm := &mockGetVMExtensionEnvironmentManager{getHandlerEnvironmentError: myerr}
_, err := getVMExtensionInternal(ctx, ii, mm)
require.Equal(t, myerr, err)
} | explode_data.jsonl/18576 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 141
} | [
2830,
3393,
3062,
11187,
12049,
1949,
3050,
12723,
1454,
1155,
353,
8840,
836,
8,
341,
20985,
1669,
1487,
7121,
12154,
7395,
12531,
7121,
2201,
12501,
7395,
9638,
83225,
1171,
13624,
615,
1669,
5975,
7121,
445,
33260,
3705,
279,
4573,
513... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestNewMigration(t *testing.T) {
old := mkSchema(table1)
new := mkSchema(table1, table2)
migration, err := NewMigration(old, new)
require.NoError(t, err)
expectedUp := ChangeSet{&CreateTable{table2}}
expectedDown := ChangeSet{&DropTable{"table2"}}
require.Equal(t, expectedUp, migration.Up)
require.Equal(t, expectedDown, migration.Down)
require.Equal(t, migration.Lock, new)
} | explode_data.jsonl/19102 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 144
} | [
2830,
3393,
3564,
20168,
1155,
353,
8840,
836,
8,
341,
61828,
1669,
23789,
8632,
15761,
16,
340,
8638,
1669,
23789,
8632,
15761,
16,
11,
1965,
17,
340,
2109,
5033,
11,
1848,
1669,
1532,
20168,
21972,
11,
501,
340,
17957,
35699,
1155,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestGetDaemonEndpointsForHostname6(t *testing.T) { // Invalid port - single form
dEndpt, err := GetDaemonEndpointsFromString("localhost:")
assert.NotNil(t, err)
assert.True(t, strings.Contains(fmt.Sprint(err), portErr))
assert.Nil(t, dEndpt)
} | explode_data.jsonl/49948 | {
"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,
1949,
89177,
80786,
2461,
88839,
21,
1155,
353,
8840,
836,
8,
314,
442,
13882,
2635,
481,
3175,
1352,
198,
2698,
3727,
417,
11,
1848,
1669,
2126,
89177,
80786,
44491,
445,
8301,
34403,
6948,
93882,
1155,
11,
1848,
340,
6948,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
func TestPBFTView(t *testing.T) {
c := GetClient(t)
pv, err := c.GetPBFTView(context.Background())
if err != nil {
t.Fatalf("PBFT view not found: %v", err)
}
t.Logf("PBFT view: \n%s", pv)
} | explode_data.jsonl/46905 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 92
} | [
2830,
3393,
40637,
3994,
851,
1155,
353,
8840,
836,
8,
341,
1444,
1669,
2126,
2959,
1155,
340,
3223,
85,
11,
1848,
1669,
272,
2234,
40637,
3994,
851,
5378,
19047,
2398,
743,
1848,
961,
2092,
341,
197,
3244,
30762,
445,
40637,
3994,
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 TestRecover_startHandlerFunc_POST_ValidationFails(t *testing.T) {
t.Parallel()
rec, _, _ := testSetup()
ctx, w, r, _ := testRequest(rec.Authboss, "POST")
if err := rec.startHandlerFunc(ctx, w, r); err != nil {
t.Error("Unexpected error:", err)
}
if w.Code != http.StatusOK {
t.Error("Unexpected status:", w.Code)
}
if !strings.Contains(w.Body.String(), "Cannot be blank") {
t.Error("Expected error about email being blank")
}
} | explode_data.jsonl/61494 | {
"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,
693,
3688,
4906,
3050,
9626,
20506,
62,
13799,
37,
6209,
1155,
353,
8840,
836,
8,
341,
3244,
41288,
7957,
2822,
67904,
11,
8358,
716,
1669,
1273,
21821,
741,
20985,
11,
289,
11,
435,
11,
716,
1669,
1273,
1900,
20635,
25233... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestJobsController_Index_HappyPath(t *testing.T) {
client, cleanup, ocrJobSpecFromFile, _, ereJobSpecFromFile, _ := setupJobSpecsControllerTestsWithJobs(t)
defer cleanup()
response, cleanup := client.Get("/v2/jobs")
defer cleanup()
cltest.AssertServerResponse(t, response, http.StatusOK)
jobSpecs := []job.SpecDB{}
err := web.ParseJSONAPIResponse(cltest.ParseResponseBody(t, response), &jobSpecs)
assert.NoError(t, err)
require.Len(t, jobSpecs, 2)
runOCRJobSpecAssertions(t, ocrJobSpecFromFile, jobSpecs[0])
runDirectRequestJobSpecAssertions(t, ereJobSpecFromFile, jobSpecs[1])
} | explode_data.jsonl/1625 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 225
} | [
2830,
3393,
40667,
2051,
50361,
2039,
11144,
1820,
1155,
353,
8840,
836,
8,
341,
25291,
11,
21290,
11,
297,
5082,
12245,
8327,
43633,
11,
8358,
38257,
12245,
8327,
43633,
11,
716,
1669,
6505,
12245,
8327,
82,
2051,
2271,
16056,
40667,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestTrade(t *testing.T) {
t.Parallel()
_, err := y.Trade("", "buy", 0, 0)
if err == nil {
t.Error("Test Failed - Trade() error", err)
}
} | explode_data.jsonl/79868 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 64
} | [
2830,
3393,
39173,
1155,
353,
8840,
836,
8,
341,
3244,
41288,
7957,
741,
197,
6878,
1848,
1669,
379,
8240,
1021,
19814,
330,
19783,
497,
220,
15,
11,
220,
15,
340,
743,
1848,
621,
2092,
341,
197,
3244,
6141,
445,
2271,
21379,
481,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 2 |
func TestConversionHub_ConvertTo(t *testing.T) {
var v1beta1ConvertedTnt = capsulev1beta1.Tenant{}
v1alpha1Tnt, v1beta1tnt := generateTenantsSpecs()
err := v1alpha1Tnt.ConvertTo(&v1beta1ConvertedTnt)
if assert.NoError(t, err) {
sort.Slice(v1beta1tnt.Spec.Owners, func(i, j int) bool {
return v1beta1tnt.Spec.Owners[i].Name < v1beta1tnt.Spec.Owners[j].Name
})
sort.Slice(v1beta1ConvertedTnt.Spec.Owners, func(i, j int) bool {
return v1beta1ConvertedTnt.Spec.Owners[i].Name < v1beta1ConvertedTnt.Spec.Owners[j].Name
})
for _, owner := range v1beta1tnt.Spec.Owners {
sort.Slice(owner.ProxyOperations, func(i, j int) bool {
return owner.ProxyOperations[i].Kind < owner.ProxyOperations[j].Kind
})
}
for _, owner := range v1beta1ConvertedTnt.Spec.Owners {
sort.Slice(owner.ProxyOperations, func(i, j int) bool {
return owner.ProxyOperations[i].Kind < owner.ProxyOperations[j].Kind
})
}
assert.Equal(t, v1beta1tnt, v1beta1ConvertedTnt)
}
} | explode_data.jsonl/45136 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 433
} | [
2830,
3393,
48237,
19316,
15100,
1621,
1249,
1155,
353,
8840,
836,
8,
341,
2405,
348,
16,
19127,
16,
61941,
51,
406,
284,
47639,
85,
16,
19127,
16,
836,
25121,
31483,
5195,
16,
7141,
16,
51,
406,
11,
348,
16,
19127,
16,
83,
406,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestMin(t *testing.T) {
testCases := []struct {
name string
arguments []int
want int
}{
{"One value", []int{1}, 1},
{"Two values", []int{1, 2}, 1},
{"Three values", []int{1, 2, 3}, 1},
{"Three values reordered", []int{2, 1, 3}, 1},
{"Negative values", []int{-1, -2}, -2},
}
for _, tc := range testCases {
t.Run(tc.name, func(t *testing.T) {
got := Min(tc.arguments...)
if got != tc.want {
// Format the function arguments nicely
formattedArgs := fmt.Sprintf("%d", tc.arguments[0])
for _, arg := range tc.arguments[1:] {
formattedArgs = fmt.Sprintf("%s, %d", formattedArgs, arg)
}
t.Errorf("Min(%s) = %d, wanted %d", formattedArgs, got, tc.want)
}
})
}
} | explode_data.jsonl/12593 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 329
} | [
2830,
3393,
6217,
1155,
353,
8840,
836,
8,
341,
18185,
37302,
1669,
3056,
1235,
341,
197,
11609,
414,
914,
198,
197,
197,
16370,
3056,
396,
198,
197,
50780,
414,
526,
198,
197,
59403,
197,
197,
4913,
3966,
897,
497,
3056,
396,
90,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
func TestPipelineRunFacts_GetSkippedTasks(t *testing.T) {
for _, tc := range []struct {
name string
state PipelineRunState
dagTasks []v1beta1.PipelineTask
finallyTasks []v1beta1.PipelineTask
expectedSkippedTasks []v1beta1.SkippedTask
}{{
name: "missing-results-skip-finally",
state: PipelineRunState{{
TaskRunName: "task0taskrun",
PipelineTask: &pts[0],
TaskRun: makeFailed(trs[0]),
}, {
PipelineTask: &pts[14],
}},
dagTasks: []v1beta1.PipelineTask{pts[0]},
finallyTasks: []v1beta1.PipelineTask{pts[14]},
expectedSkippedTasks: []v1beta1.SkippedTask{{
Name: pts[14].Name,
}},
}, {
name: "when-expressions-skip-finally",
state: PipelineRunState{{
PipelineTask: &pts[10],
}},
finallyTasks: []v1beta1.PipelineTask{pts[10]},
expectedSkippedTasks: []v1beta1.SkippedTask{{
Name: pts[10].Name,
WhenExpressions: []v1beta1.WhenExpression{{
Input: "foo",
Operator: "notin",
Values: []string{"foo", "bar"},
}},
}},
}} {
t.Run(tc.name, func(t *testing.T) {
d, err := dag.Build(v1beta1.PipelineTaskList(tc.dagTasks), v1beta1.PipelineTaskList(tc.dagTasks).Deps())
if err != nil {
t.Fatalf("Unexpected error while building graph for DAG tasks %v: %v", v1beta1.PipelineTaskList{pts[0]}, err)
}
df, err := dag.Build(v1beta1.PipelineTaskList(tc.finallyTasks), map[string][]string{})
if err != nil {
t.Fatalf("Unexpected error while building graph for final tasks %v: %v", v1beta1.PipelineTaskList{pts[14]}, err)
}
facts := PipelineRunFacts{
State: tc.state,
TasksGraph: d,
FinalTasksGraph: df,
}
actualSkippedTasks := facts.GetSkippedTasks()
if d := cmp.Diff(tc.expectedSkippedTasks, actualSkippedTasks); d != "" {
t.Fatalf("Mismatch skipped tasks %s", diff.PrintWantGot(d))
}
})
}
} | explode_data.jsonl/18203 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 900
} | [
2830,
3393,
34656,
6727,
37,
11359,
13614,
19290,
6450,
25449,
1155,
353,
8840,
836,
8,
341,
2023,
8358,
17130,
1669,
2088,
3056,
1235,
341,
197,
11609,
338,
914,
198,
197,
24291,
394,
40907,
6727,
1397,
198,
197,
2698,
351,
25449,
1797... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.