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 Test_ParseLine(t *testing.T) {
testTable := []parseLineTest{
{
lineContentMapping: map[string]string{"time": "12/Nov/2019:10:20:07 +0100",
"ip": "34.65.133.58",
"request": "GET /robots.txt HTTP/1.1",
"statusCode": "200",
"requestDuration": "0.123", // in s, as logged by nginx
"sloClass": "-",
"sloDomain": "-",
"sloApp": "-",
"sloResult": "-",
"sloEndpoint": "-",
"frpcStatus": "-",
},
isLineValid: true,
},
}
lineParseRegexpCompiled := regexp.MustCompile(lineParseRegexp)
emptyGroupRegexpCompiled := regexp.MustCompile(emptyGroupRegexp)
for _, test := range testTable {
requestLine := getRequestLine(test.lineContentMapping)
data, err := parseLine(lineParseRegexpCompiled, emptyGroupRegexpCompiled, requestLine)
if err != nil {
t.Fatalf("unable to parse request line '%s': %v", requestLine, err)
}
for k, v := range test.lineContentMapping {
if !emptyGroupRegexpCompiled.MatchString(v) {
continue
}
// test that empty group was correctly replaced by an empty string
if _, ok := data[k]; ok {
t.Errorf("Content named group '%s':'%s' should not have been included in the resulting stringmap (as value matches emptyGroupRegexp: '%s'): %+v", k, v, emptyGroupRegexp, data)
}
}
}
} | explode_data.jsonl/11274 | {
"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,
77337,
2460,
1155,
353,
8840,
836,
8,
341,
18185,
2556,
1669,
3056,
6400,
2460,
2271,
515,
197,
197,
515,
298,
27109,
2762,
6807,
25,
2415,
14032,
30953,
4913,
1678,
788,
330,
16,
17,
14,
18944,
14,
17,
15,
16,
24,
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... | 6 |
func Test500ErrorHttpResponseWithValidJSONBody(t *testing.T) {
var (
ch = make(chan []*targetgroup.Group, 1)
client = fetchApps
)
// Simulate 500 error with a valid JSON response.
respHandler := func(w http.ResponseWriter, r *http.Request) {
w.WriteHeader(http.StatusInternalServerError)
w.Header().Set("Content-Type", "application/json")
io.WriteString(w, `{}`)
}
// Create a test server with mock HTTP handler.
ts := httptest.NewServer(http.HandlerFunc(respHandler))
defer ts.Close()
// Backup conf for future tests.
backupConf := conf
defer func() {
conf = backupConf
}()
// Setup conf for the test case.
conf = SDConfig{Servers: []string{ts.URL}}
// Execute test case and validate behaviour.
if err := testUpdateServices(client, ch); err == nil {
t.Fatalf("Expected error for 5xx HTTP response from marathon server")
}
} | explode_data.jsonl/73168 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 291
} | [
2830,
3393,
20,
15,
15,
1454,
43342,
2354,
4088,
5370,
5444,
1155,
353,
8840,
836,
8,
341,
2405,
2399,
197,
23049,
257,
284,
1281,
35190,
29838,
5657,
4074,
5407,
11,
220,
16,
340,
197,
25291,
284,
7807,
53602,
198,
197,
340,
197,
3... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestNative_Vstring(t *testing.T) {
var v types.JsonState
i := 0
s := `test"test\n2"`
__vstring(&s, &i, &v)
assert.Equal(t, 5, i)
assert.Equal(t, -1, v.Ep)
assert.Equal(t, int64(0), v.Iv)
__vstring(&s, &i, &v)
assert.Equal(t, 13, i)
assert.Equal(t, 9, v.Ep)
assert.Equal(t, int64(5), v.Iv)
} | explode_data.jsonl/60917 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 186
} | [
2830,
3393,
20800,
2334,
917,
1155,
353,
8840,
836,
8,
341,
262,
762,
348,
4494,
13562,
1397,
198,
262,
600,
1669,
220,
15,
198,
262,
274,
1669,
1565,
1944,
1,
1944,
1699,
17,
8805,
262,
1304,
85,
917,
2099,
82,
11,
609,
72,
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 TestGetURLParameters_ContainsHostParameters(t *testing.T) {
mainRouter := Router{}
bag := newURLParameterBag(2)
bag.add("id", "100")
bag.add("subdomain", "dummy")
bag.add("domain", "test")
f := assertRequestHasParameterHandler(t, bag)
options := NewMatchingOptions()
options.Host = "{subdomain:[a-z]+}.{domain:[a-z]+}.com"
_ = mainRouter.Register(http.MethodGet, "/path1/{id}", f, options)
assertPathWithHostFound(t, mainRouter, "GET", "/path1/100", "dummy.test.com")
} | explode_data.jsonl/31721 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 182
} | [
2830,
3393,
1949,
3144,
9706,
62,
23805,
9296,
9706,
1155,
353,
8840,
836,
8,
341,
36641,
9523,
1669,
10554,
31483,
2233,
351,
1669,
501,
3144,
4971,
12933,
7,
17,
340,
2233,
351,
1364,
445,
307,
497,
330,
16,
15,
15,
1138,
2233,
35... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestSchedulerExtender(t *testing.T) {
_, s, closeFn := framework.RunAMaster(nil)
defer closeFn()
ns := framework.CreateTestingNamespace("scheduler-extender", s, t)
defer framework.DeleteTestingNamespace(ns, s, t)
clientSet := clientset.NewForConfigOrDie(&restclient.Config{Host: s.URL, ContentConfig: restclient.ContentConfig{GroupVersion: testapi.Groups[v1.GroupName].GroupVersion()}})
extender1 := &Extender{
name: "extender1",
predicates: []fitPredicate{machine_1_2_3_Predicate},
prioritizers: []priorityConfig{{machine_2_Prioritizer, 1}},
}
es1 := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) {
extender1.serveHTTP(t, w, req)
}))
defer es1.Close()
extender2 := &Extender{
name: "extender2",
predicates: []fitPredicate{machine_2_3_5_Predicate},
prioritizers: []priorityConfig{{machine_3_Prioritizer, 1}},
Client: clientSet,
}
es2 := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) {
extender2.serveHTTP(t, w, req)
}))
defer es2.Close()
extender3 := &Extender{
name: "extender3",
predicates: []fitPredicate{machine_1_2_3_Predicate},
prioritizers: []priorityConfig{{machine_2_Prioritizer, 5}},
nodeCacheCapable: true,
}
es3 := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) {
extender3.serveHTTP(t, w, req)
}))
defer es3.Close()
policy := schedulerapi.Policy{
ExtenderConfigs: []schedulerapi.ExtenderConfig{
{
URLPrefix: es1.URL,
FilterVerb: filter,
PrioritizeVerb: prioritize,
Weight: 3,
EnableHttps: false,
},
{
URLPrefix: es2.URL,
FilterVerb: filter,
PrioritizeVerb: prioritize,
BindVerb: bind,
Weight: 4,
EnableHttps: false,
},
{
URLPrefix: es3.URL,
FilterVerb: filter,
PrioritizeVerb: prioritize,
Weight: 10,
EnableHttps: false,
NodeCacheCapable: true,
},
},
}
policy.APIVersion = testapi.Groups[v1.GroupName].GroupVersion().String()
informerFactory := informers.NewSharedInformerFactory(clientSet, 0)
schedulerConfigFactory := factory.NewConfigFactory(
v1.DefaultSchedulerName,
clientSet,
informerFactory.Core().V1().Nodes(),
informerFactory.Core().V1().Pods(),
informerFactory.Core().V1().PersistentVolumes(),
informerFactory.Core().V1().PersistentVolumeClaims(),
informerFactory.Core().V1().ReplicationControllers(),
informerFactory.Extensions().V1beta1().ReplicaSets(),
informerFactory.Apps().V1beta1().StatefulSets(),
informerFactory.Core().V1().Services(),
v1.DefaultHardPodAffinitySymmetricWeight,
enableEquivalenceCache,
)
schedulerConfig, err := schedulerConfigFactory.CreateFromConfig(policy)
if err != nil {
t.Fatalf("Couldn't create scheduler config: %v", err)
}
eventBroadcaster := record.NewBroadcaster()
schedulerConfig.Recorder = eventBroadcaster.NewRecorder(api.Scheme, v1.EventSource{Component: v1.DefaultSchedulerName})
eventBroadcaster.StartRecordingToSink(&v1core.EventSinkImpl{Interface: v1core.New(clientSet.CoreV1().RESTClient()).Events("")})
scheduler, _ := scheduler.NewFromConfigurator(&scheduler.FakeConfigurator{Config: schedulerConfig}, nil...)
informerFactory.Start(schedulerConfig.StopEverything)
scheduler.Run()
defer close(schedulerConfig.StopEverything)
DoTestPodScheduling(ns, t, clientSet)
} | explode_data.jsonl/29831 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 1417
} | [
2830,
3393,
38878,
6756,
1659,
1155,
353,
8840,
836,
8,
341,
197,
6878,
274,
11,
3265,
24911,
1669,
12626,
16708,
1402,
2300,
27907,
340,
16867,
3265,
24911,
2822,
84041,
1669,
12626,
7251,
16451,
22699,
445,
63122,
66103,
1659,
497,
274,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestParseConfig_CustomLegacyInsecureSkipVerify(t *testing.T) {
input := []byte(`bucket: abcd
insecure: false
http_config:
insecure_skip_verify: true
tls_config:
insecure_skip_verify: false
`)
cfg, err := parseConfig(input)
testutil.Ok(t, err)
transport, err := DefaultTransport(cfg)
testutil.Ok(t, err)
testutil.Equals(t, true, transport.TLSClientConfig.InsecureSkipVerify)
} | explode_data.jsonl/6236 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 151
} | [
2830,
3393,
14463,
2648,
57402,
77415,
641,
25132,
35134,
32627,
1155,
353,
8840,
836,
8,
341,
22427,
1669,
3056,
3782,
5809,
30410,
25,
668,
4385,
198,
258,
25132,
25,
895,
198,
1254,
5332,
510,
220,
61845,
44830,
35638,
25,
830,
198,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestXHashScan(t *testing.T) {
c := getTestConn()
defer c.Close()
key := "scan_hash"
c.Do("HMSET", key, "a", 1, "b", 2)
if ay, err := goredis.Values(c.Do("XHSCAN", key, "")); err != nil {
t.Fatal(err)
} else if len(ay) != 2 {
t.Fatal(len(ay))
} else {
checkScanValues(t, ay[1], "a", 1, "b", 2)
}
} | explode_data.jsonl/77086 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 158
} | [
2830,
3393,
55,
6370,
26570,
1155,
353,
8840,
836,
8,
341,
1444,
1669,
633,
2271,
9701,
741,
16867,
272,
10421,
2822,
23634,
1669,
330,
16405,
8950,
698,
1444,
33596,
445,
52148,
5884,
497,
1376,
11,
330,
64,
497,
220,
16,
11,
330,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
func TestMagic(t *testing.T) {
var hasFile bool
if _, err := exec.LookPath("file"); err == nil {
hasFile = true
}
for i, tt := range tests {
var err error
data := []byte(tt.data)
if tt.fileName != "" {
data, err = ioutil.ReadFile("testdata/" + tt.fileName)
if err != nil {
t.Fatalf("Error reading %s: %v", tt.fileName,
err)
}
}
mime := MIMEType(data)
if mime != tt.want {
t.Errorf("%d. got %q; want %q", i, mime, tt.want)
}
if !hasFile {
continue
}
fmime, ok := runFileCmd(data)
if ok && fmime != tt.want {
t.Logf("%d. warning: got %q via file; want %q", i, fmime, tt.want)
}
}
} | explode_data.jsonl/19975 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 310
} | [
2830,
3393,
43538,
1155,
353,
8840,
836,
8,
341,
2405,
702,
1703,
1807,
198,
743,
8358,
1848,
1669,
3883,
36851,
1820,
445,
1192,
5038,
1848,
621,
2092,
341,
197,
63255,
1703,
284,
830,
198,
197,
630,
2023,
600,
11,
17853,
1669,
2088,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestInterfaceIssue795(t *testing.T) {
gopClTest(t, `
type I interface {
a(s string) I
b(s string) string
}
type T1 int
func (t T1) a(s string) I {
return t
}
func (T1) b(s string) string {
return s
}
`, `package main
type I interface {
a(s string) I
b(s string) string
}
type T1 int
func (t T1) a(s string) I {
return t
}
func (T1) b(s string) string {
return s
}
`)
} | explode_data.jsonl/73578 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 172
} | [
2830,
3393,
5051,
42006,
22,
24,
20,
1155,
353,
8840,
836,
8,
341,
3174,
453,
5066,
2271,
1155,
11,
22074,
1313,
358,
3749,
341,
11323,
1141,
914,
8,
358,
198,
2233,
1141,
914,
8,
914,
198,
630,
1313,
350,
16,
526,
271,
2830,
320,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestSelect1(t *testing.T) {
b := &BuilderStandard{}
s := NewSelect(b)
sql, args, err := s.Select("name", "age").
From("student").
Where(expr.In("age", 13, 14)).
AndWhere(expr.Like("name", `%mu%`)).
OrWhere(expr.Group("AND", expr.Op("age", ">", 100), expr.Op("age", "<", 200))).
ToSql()
if err != nil {
t.Fatal(err)
}
assert.Equal(t, "SELECT name,age FROM student WHERE age IN (?, ?) AND name LIKE ? OR (age>? AND age<?)",
sql)
assert.Equal(t, []interface{}{13, 14, "%mu%", 100, 200}, args)
// t.Error(sql, args)
} | explode_data.jsonl/16783 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 229
} | [
2830,
3393,
3379,
16,
1155,
353,
8840,
836,
8,
1476,
2233,
1669,
609,
3297,
19781,
16094,
1903,
1669,
1532,
3379,
1883,
692,
30633,
11,
2827,
11,
1848,
1669,
274,
14752,
445,
606,
497,
330,
424,
38609,
197,
197,
3830,
445,
12038,
3860... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestRejectBadConfig(t *testing.T) {
cf := NewFilter(&mockconfigtx.Manager{ValidateVal: fmt.Errorf("Error")})
config, _ := proto.Marshal(&cb.ConfigEnvelope{})
configBytes, _ := proto.Marshal(&cb.Payload{Header: &cb.Header{ChannelHeader: utils.MarshalOrPanic(&cb.ChannelHeader{Type: int32(cb.HeaderType_CONFIG)})}, Data: config})
result, _ := cf.Apply(&cb.Envelope{
Payload: configBytes,
})
if result != filter.Reject {
t.Fatal("Should have rejected bad config message")
}
} | explode_data.jsonl/18642 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 177
} | [
2830,
3393,
78413,
17082,
2648,
1155,
353,
8840,
836,
8,
341,
96989,
1669,
1532,
5632,
2099,
16712,
1676,
3998,
58298,
90,
17926,
2208,
25,
8879,
13080,
445,
1454,
899,
3518,
25873,
11,
716,
1669,
18433,
37271,
2099,
7221,
10753,
62712,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestPostgresqlGeneratesMetricsIntegration(t *testing.T) {
if testing.Short() {
t.Skip("Skipping integration test in short mode")
}
acc := queryRunner(t, query{{
Sqlquery: "select * from pg_stat_database",
Version: 901,
Withdbname: false,
Tagvalue: "",
}})
intMetrics := []string{
"xact_commit",
"xact_rollback",
"blks_read",
"blks_hit",
"tup_returned",
"tup_fetched",
"tup_inserted",
"tup_updated",
"tup_deleted",
"conflicts",
"temp_files",
"temp_bytes",
"deadlocks",
"numbackends",
"datid",
}
int32Metrics := []string{}
floatMetrics := []string{
"blk_read_time",
"blk_write_time",
}
stringMetrics := []string{
"datname",
}
metricsCounted := 0
for _, metric := range intMetrics {
assert.True(t, acc.HasInt64Field("postgresql", metric))
metricsCounted++
}
for _, metric := range int32Metrics {
assert.True(t, acc.HasInt32Field("postgresql", metric))
metricsCounted++
}
for _, metric := range floatMetrics {
assert.True(t, acc.HasFloatField("postgresql", metric))
metricsCounted++
}
for _, metric := range stringMetrics {
assert.True(t, acc.HasStringField("postgresql", metric))
metricsCounted++
}
assert.True(t, metricsCounted > 0)
assert.Equal(t, len(floatMetrics)+len(intMetrics)+len(int32Metrics)+len(stringMetrics), metricsCounted)
} | explode_data.jsonl/20135 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 557
} | [
2830,
3393,
4133,
81624,
5531,
973,
27328,
52464,
1155,
353,
8840,
836,
8,
341,
743,
7497,
55958,
368,
341,
197,
3244,
57776,
445,
85945,
17590,
1273,
304,
2805,
3856,
1138,
197,
630,
197,
4475,
1669,
3239,
19486,
1155,
11,
3239,
90,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 6 |
func TestNewFileItem_ParentFolder(t *testing.T) {
f := &fileDialog{file: &FileDialog{}}
_ = f.makeUI()
currentDir, _ := filepath.Abs(".")
parentDir := filepath.Dir(currentDir)
f.setDirectory(currentDir)
item := &fileDialogItem{picker: f, icon: canvas.NewImageFromResource(theme.FolderOpenIcon()),
name: "(Parent)", path: parentDir, dir: true}
item.ExtendBaseWidget(item)
assert.Equal(t, item.name, "(Parent)")
test.Tap(item)
assert.False(t, item.isCurrent)
assert.Equal(t, (*fileDialogItem)(nil), f.selected)
assert.Equal(t, parentDir, f.dir)
} | explode_data.jsonl/76868 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 210
} | [
2830,
3393,
3564,
1703,
1234,
1088,
1390,
13682,
1155,
353,
8840,
836,
8,
341,
1166,
1669,
609,
1192,
4468,
90,
1192,
25,
609,
26596,
6257,
532,
197,
62,
284,
282,
10117,
2275,
741,
20121,
6184,
11,
716,
1669,
26054,
33255,
5680,
1138... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestConfigActiveView(t *testing.T) {
mk := NewMockKubeSettings()
cfg := config.NewConfig(mk)
assert.Nil(t, cfg.Load("testdata/k9s.yml"))
assert.Equal(t, "ctx", cfg.ActiveView())
} | explode_data.jsonl/19256 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 79
} | [
2830,
3393,
2648,
5728,
851,
1155,
353,
8840,
836,
8,
341,
2109,
74,
1669,
1532,
11571,
42,
3760,
6086,
741,
50286,
1669,
2193,
7121,
2648,
1255,
74,
692,
6948,
59678,
1155,
11,
13286,
13969,
445,
92425,
14109,
24,
82,
33936,
5455,
69... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
func TestTypeSwitch(t *testing.T) {
gopClTest(t, `
func bar(p *interface{}) {
}
func foo(v interface{}) {
switch t := v.(type) {
case int, string:
bar(&v)
case bool:
var x bool = t
default:
bar(nil)
}
}
`, `package main
func bar(p *interface {
}) {
}
func foo(v interface {
}) {
switch t := v.(type) {
case int, string:
bar(&v)
case bool:
var x bool = t
default:
bar(nil)
}
}
`)
} | explode_data.jsonl/73601 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 185
} | [
2830,
3393,
929,
16837,
1155,
353,
8840,
836,
8,
341,
3174,
453,
5066,
2271,
1155,
11,
1565,
271,
2830,
3619,
1295,
353,
4970,
28875,
341,
630,
2830,
15229,
3747,
3749,
28875,
341,
8961,
259,
1669,
348,
12832,
1313,
8,
341,
2722,
526,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestAllocations_GarbageCollectAll(t *testing.T) {
t.Parallel()
require := require.New(t)
client, cleanup := TestClient(t, nil)
defer cleanup()
req := &nstructs.NodeSpecificRequest{}
var resp nstructs.GenericResponse
require.Nil(client.ClientRPC("Allocations.GarbageCollectAll", &req, &resp))
} | explode_data.jsonl/34237 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 106
} | [
2830,
3393,
25154,
804,
2646,
277,
20652,
47504,
2403,
1155,
353,
8840,
836,
8,
341,
3244,
41288,
7957,
741,
17957,
1669,
1373,
7121,
1155,
340,
25291,
11,
21290,
1669,
3393,
2959,
1155,
11,
2092,
340,
16867,
21290,
2822,
24395,
1669,
6... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestInverse(t *testing.T) {
tests := []struct {
in string //十六进制编码值
expected string //预期十六进制编码值
}{
//secp256k1 prime(又名0)
{"0", "0"},
{"fffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f", "0"},
{"0", "fffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"},
//secp256k1主-1
{
"fffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2e",
"fffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2e",
},
//SECP256K1主-2
{
"fffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2d",
"7fffffffffffffffffffffffffffffffffffffffffffffffffffffff7ffffe17",
},
//随机抽样
{
"16fb970147a9acc73654d4be233cc48b875ce20a2122d24f073d29bd28805aca",
"987aeb257b063df0c6d1334051c47092b6d8766c4bf10c463786d93f5bc54354",
},
{
"69d1323ce9f1f7b3bd3c7320b0d6311408e30281e273e39a0d8c7ee1c8257919",
"49340981fa9b8d3dad72de470b34f547ed9179c3953797d0943af67806f4bb6",
},
{
"e0debf988ae098ecda07d0b57713e97c6d213db19753e8c95aa12a2fc1cc5272",
"64f58077b68af5b656b413ea366863f7b2819f8d27375d9c4d9804135ca220c2",
},
{
"dcd394f91f74c2ba16aad74a22bb0ed47fe857774b8f2d6c09e28bfb14642878",
"fb848ec64d0be572a63c38fe83df5e7f3d032f60bf8c969ef67d36bf4ada22a9",
},
}
t.Logf("Running %d tests", len(tests))
for i, test := range tests {
f := new(fieldVal).SetHex(test.in).Normalize()
expected := new(fieldVal).SetHex(test.expected).Normalize()
result := f.Inverse().Normalize()
if !result.Equals(expected) {
t.Errorf("fieldVal.Inverse #%d wrong result\n"+
"got: %v\nwant: %v", i, result, expected)
continue
}
}
} | explode_data.jsonl/369 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 849
} | [
2830,
3393,
69179,
1155,
353,
8840,
836,
8,
341,
78216,
1669,
3056,
1235,
341,
258,
981,
914,
442,
102853,
41299,
43316,
112950,
25511,
198,
7325,
914,
442,
104394,
102853,
41299,
43316,
112950,
25511,
198,
197,
59403,
322,
325,
4672,
17,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
func TestPatch_length(t *testing.T) {
program, err := expr.Compile(
`String.length == 5`,
expr.Env(mockEnv{}),
expr.Patch(&lengthPatcher{}),
)
require.NoError(t, err)
env := mockEnv{String: "hello"}
output, err := expr.Run(program, env)
require.NoError(t, err)
require.Equal(t, true, output)
} | explode_data.jsonl/36913 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 129
} | [
2830,
3393,
43622,
5118,
1155,
353,
8840,
836,
8,
341,
197,
14906,
11,
1848,
1669,
15169,
89323,
1006,
197,
197,
63,
703,
1954,
621,
220,
20,
12892,
197,
8122,
649,
81214,
30389,
14359,
6257,
1326,
197,
8122,
649,
1069,
754,
2099,
412... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestPassphraseValidate(t *testing.T) {
var tests = []struct {
passphrase passphrase
valid bool
}{
// valid tests
{passphrase("popcorn"), true},
{passphrase("pa$$word"), true},
{passphrase("pdsasdas"), true},
{passphrase("[asdsdasdmasn]"), true},
{passphrase("popwas"), true},
{passphrase("oi0isas"), true},
{passphrase("0=2oasdaj"), true},
{passphrase("testPass"), true},
{passphrase("asdasdasd"), true},
{passphrase("testP[ss"), true},
{passphrase("195s2f5"), true},
{passphrase("%%%%%%%s"), true},
{passphrase("#491k2@"), true},
// invalid tests
{passphrase("#49"), false},
{passphrase("#f9"), false},
{passphrase("as9"), false},
{passphrase("bn9"), false},
{passphrase("pop"), false},
{passphrase("lol"), false},
{passphrase("123"), false},
{passphrase("default"), false},
}
for _, test := range tests {
pass := test.passphrase
valid := pass.validate()
if valid != test.valid {
t.Error("Test failed: passphrase:{} expectedOutput:{} output:{}", test.passphrase, test.valid, valid)
}
}
} | explode_data.jsonl/46191 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 420
} | [
2830,
3393,
12187,
27710,
17926,
1155,
353,
8840,
836,
8,
341,
2405,
7032,
284,
3056,
1235,
341,
197,
41431,
27710,
75493,
198,
197,
56322,
414,
1807,
198,
197,
59403,
197,
197,
322,
2697,
7032,
198,
197,
197,
90,
6385,
27710,
445,
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... | 3 |
func TestProjectionHandler_processEvent(t *testing.T) {
type fields struct {
stmts []*Statement
pushSet bool
shouldPush *time.Timer
}
type args struct {
ctx context.Context
event eventstore.EventReader
reduce Reduce
}
type want struct {
isErr func(err error) bool
stmts []*Statement
}
tests := []struct {
name string
fields fields
args args
want want
}{
{
name: "reduce fails",
fields: fields{
stmts: nil,
pushSet: false,
shouldPush: nil,
},
args: args{
reduce: testReduceErr(ErrReduce),
},
want: want{
isErr: func(err error) bool {
return errors.Is(err, ErrReduce)
},
stmts: nil,
},
},
{
name: "single new stmt",
fields: fields{
stmts: nil,
pushSet: false,
shouldPush: initTimer(),
},
args: args{
reduce: testReduce(newTestStatement("aggregate1", 1, 0)),
},
want: want{
isErr: func(err error) bool {
return err == nil
},
stmts: []*Statement{
newTestStatement("aggregate1", 1, 0),
},
},
},
{
name: "existing stmts",
fields: fields{
stmts: []*Statement{
newTestStatement("aggregate1", 1, 0),
},
pushSet: false,
shouldPush: initTimer(),
},
args: args{
reduce: testReduce(newTestStatement("aggregate1", 2, 1)),
},
want: want{
isErr: func(err error) bool {
return err == nil
},
stmts: []*Statement{
newTestStatement("aggregate1", 1, 0),
newTestStatement("aggregate1", 2, 1),
},
},
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
h := NewProjectionHandler(ProjectionHandlerConfig{
HandlerConfig: HandlerConfig{
Eventstore: nil,
},
ProjectionName: "",
RequeueEvery: -1,
})
h.stmts = tt.fields.stmts
h.pushSet = tt.fields.pushSet
h.shouldPush = tt.fields.shouldPush
err := h.processEvent(tt.args.ctx, tt.args.event, tt.args.reduce)
if !tt.want.isErr(err) {
t.Errorf("unexpected error %v", err)
}
if !reflect.DeepEqual(tt.want.stmts, h.stmts) {
t.Errorf("unexpected stmts\n want: %v\n got: %v", tt.want.stmts, h.stmts)
}
})
}
} | explode_data.jsonl/81371 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 1061
} | [
2830,
3393,
46321,
3050,
11305,
1556,
1155,
353,
8840,
836,
8,
341,
13158,
5043,
2036,
341,
197,
55822,
82,
414,
29838,
8636,
198,
197,
43155,
1649,
262,
1807,
198,
197,
197,
5445,
16644,
353,
1678,
41143,
198,
197,
532,
13158,
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... | 1 |
func TestImageInfoCreatedAtZero(t *testing.T) {
info := mustMakeInfo("my/image:tag", time.Now())
info = Info{ID: info.ID}
bytes, err := json.Marshal(info)
if err != nil {
t.Fatal(err)
}
var info1 map[string]interface{}
if err = json.Unmarshal(bytes, &info1); err != nil {
t.Fatal(err)
}
if _, ok := info1["CreatedAt"]; ok {
t.Errorf("serialised Info included zero time field; expected it to be omitted\n%s", string(bytes))
}
} | explode_data.jsonl/60187 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 176
} | [
2830,
3393,
1906,
1731,
70387,
17999,
1155,
353,
8840,
836,
8,
341,
27043,
1669,
1969,
8078,
1731,
445,
2408,
23349,
25,
4578,
497,
882,
13244,
2398,
27043,
284,
13074,
90,
915,
25,
3546,
9910,
532,
70326,
11,
1848,
1669,
2951,
37271,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestClientKeyUpdate(t *testing.T) {
test := &clientTest{
name: "KeyUpdate",
args: []string{"-state"},
sendKeyUpdate: true,
}
runClientTestTLS13(t, test)
} | explode_data.jsonl/27714 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 86
} | [
2830,
3393,
2959,
1592,
4289,
1155,
353,
8840,
836,
8,
341,
18185,
1669,
609,
2972,
2271,
515,
197,
11609,
25,
688,
330,
1592,
4289,
756,
197,
31215,
25,
688,
3056,
917,
4913,
12,
2454,
7115,
197,
32817,
1592,
4289,
25,
830,
345,
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 |
func TestKVPut(t *testing.T) {
defer testutil.AfterTest(t)
clus := integration.NewClusterV3(t, &integration.ClusterConfig{Size: 3})
defer clus.Terminate(t)
lapi := clus.RandClient()
kv := clus.RandClient()
ctx := context.TODO()
resp, err := lapi.Grant(context.Background(), 10)
if err != nil {
t.Fatalf("failed to create lease %v", err)
}
tests := []struct {
key, val string
leaseID clientv3.LeaseID
}{
{"foo", "bar", clientv3.NoLease},
{"hello", "world", resp.ID},
}
for i, tt := range tests {
if _, err := kv.Put(ctx, tt.key, tt.val, clientv3.WithLease(tt.leaseID)); err != nil {
t.Fatalf("#%d: couldn't put %q (%v)", i, tt.key, err)
}
resp, err := kv.Get(ctx, tt.key)
if err != nil {
t.Fatalf("#%d: couldn't get key (%v)", i, err)
}
if len(resp.Kvs) != 1 {
t.Fatalf("#%d: expected 1 key, got %d", i, len(resp.Kvs))
}
if !bytes.Equal([]byte(tt.val), resp.Kvs[0].Value) {
t.Errorf("#%d: val = %s, want %s", i, tt.val, resp.Kvs[0].Value)
}
if tt.leaseID != clientv3.LeaseID(resp.Kvs[0].Lease) {
t.Errorf("#%d: val = %d, want %d", i, tt.leaseID, resp.Kvs[0].Lease)
}
}
} | explode_data.jsonl/16398 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 539
} | [
2830,
3393,
42,
13378,
332,
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,
18,
3518,
16867,
1185,
355,
836,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 8 |
func TestAbandonedEnumerate(t *testing.T) {
const SCRIPT = `
var o = {baz: true, foo: true, bar: true};
var res = "";
for (var i in o) {
delete o.baz;
for (var j in o) {
res += i + "-" + j + " ";
break;
}
}
res;
`
testScript1(SCRIPT, asciiString("baz-foo foo-foo bar-foo "), t)
} | explode_data.jsonl/10524 | {
"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,
5830,
90144,
5882,
349,
1155,
353,
8840,
836,
8,
341,
4777,
53679,
284,
22074,
2405,
297,
284,
314,
42573,
25,
830,
11,
15229,
25,
830,
11,
3619,
25,
830,
2440,
2405,
592,
284,
5438,
2023,
320,
947,
600,
304,
297,
8,
3... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestGetVaryUnused(t *testing.T) {
resetTest()
req, err := http.NewRequest("GET", s.server.URL+"/varyunused", nil)
if err != nil {
t.Fatal(err)
}
req.Header.Set("Accept", "text/plain")
{
resp, err := s.client.Do(req)
if err != nil {
t.Fatal(err)
}
defer resp.Body.Close()
if resp.Header.Get("Vary") == "" {
t.Fatalf(`Vary header is blank`)
}
_, err = ioutil.ReadAll(resp.Body)
if err != nil {
t.Fatal(err)
}
}
{
resp, err := s.client.Do(req)
if err != nil {
t.Fatal(err)
}
defer resp.Body.Close()
if resp.Header.Get(XFromCache) != "1" {
t.Fatalf(`XFromCache header isn't "1": %v`, resp.Header.Get(XFromCache))
}
}
} | explode_data.jsonl/77624 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 328
} | [
2830,
3393,
1949,
53,
658,
94033,
1155,
353,
8840,
836,
8,
341,
70343,
2271,
741,
24395,
11,
1848,
1669,
1758,
75274,
445,
3806,
497,
274,
12638,
20893,
27569,
82976,
24713,
497,
2092,
340,
743,
1848,
961,
2092,
341,
197,
3244,
26133,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestDomainsConfig_Empty(t *testing.T) {
assert := assertlib.New(t)
globalConfig := viper.New()
globalConfig.Set("domains", []string{})
config, err := DomainsConfig(globalConfig)
assert.NoError(err)
assert.Len(config, 0)
} | explode_data.jsonl/61946 | {
"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,
74713,
2648,
76060,
1595,
1155,
353,
8840,
836,
8,
341,
6948,
1669,
2060,
2740,
7121,
1155,
340,
18842,
2648,
1669,
95132,
7121,
741,
18842,
2648,
4202,
445,
59621,
497,
3056,
917,
37790,
25873,
11,
1848,
1669,
20751,
1735,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestTopDownElseKeyword(t *testing.T) {
tests := []struct {
note string
path string
expected interface{}
}{
{"no-op", "ex.no_op", "true"},
{"trivial", "ex.bool", "true"},
{"trivial-non-bool", "ex.non_bool", "[100]"},
{"trivial-3", "ex.triple", `"hello"`},
{"var-head", "ex.vars", `["hello", "goodbye"]`},
{"ref-head", "ex.refs", `["hello", "goodbye"]`},
{"first-match", "ex.multiple_defined", `true`},
{"default-1", "ex.default_1", "2"},
{"default-2", "ex.default_2", "2"},
{"multiple-roots", "ex.multiple_roots", `2`},
{"indexed", "ex.indexed", "2"},
{"conflict-1", "ex.conflict_1", completeDocConflictErr(nil)},
{"conflict-2", "ex.conflict_2", completeDocConflictErr(nil)},
{"functions", "ex.fn_result", `["large", "small", "medium"]`},
}
for _, tc := range tests {
compiler := compileModules([]string{
`package ex
no_op { true } else = false { true }
bool { false } else { true }
non_bool = null { false } else = [100] { true }
triple { false } else { false } else = "hello" { true }
vars { false } else = ["hello", x] { data.b.v2 = x }
refs { false } else = ["hello", data.b.v2] { true }
multiple_defined = false { false } else = true { true } else = false { true }
default default_1 = 1
default_1 { false } default_1 = 2 { true }
default default_2 = 2
default_2 { false } default_2 = 1 { false }
multiple_roots {
false
} else = 1 {
false
} else = 2 {
true
} else = 3 {
true
}
multiple_roots = 2
multiple_roots = 3 {
false
} else = 2 {
true
}
indexed {
data.a[0] = 0
} else = 2 {
data.a[0] = 1
} else = 3 {
data.a[0] = 1
}
indexed {
data.a[0] = 1
data.a[2] = 2
} else {
false
} else = 2 {
data.a[0] = x
x = 1
data.a[2] = 3
}
conflict_1 { false } else { true }
conflict_1 = false { true }
conflict_2 { false } else = false { true }
conflict_2 { false } else = true { true }
fn_result = [x,y,z] { fn(101, true, x); fn(100, true, y); fn(100, false, z) }
fn(x, y) = "large" {
x > 100
} else = "small" {
y = true
} else = "medium" {
true
}
`,
})
store := inmem.NewFromObject(loadSmallTestData())
assertTopDownWithPath(t, compiler, store, tc.note, strings.Split(tc.path, "."), "", tc.expected)
}
} | explode_data.jsonl/25225 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 1085
} | [
2830,
3393,
5366,
4454,
22971,
34481,
1155,
353,
8840,
836,
8,
341,
78216,
1669,
3056,
1235,
341,
197,
9038,
1272,
257,
914,
198,
197,
26781,
257,
914,
198,
197,
42400,
3749,
16094,
197,
59403,
197,
197,
4913,
2152,
29492,
497,
330,
3... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
func TestHTTPHeaderMatch(t *testing.T) {
t.Run("simple http header match", func(t *testing.T) {
headersConfig := []v2.HeaderMatcher{
{
Name: "test-key",
Value: "test-value",
},
{
Name: "key2",
Value: "value2",
},
}
// request headers must contains all of kvs
// request header can contains kv not in the config
matcher := CreateHTTPHeaderMatcher(headersConfig)
for idx, c := range []struct {
requestHeader map[string]string
matched bool
}{
{map[string]string{"test-key": "test-value", "key2": "value2"}, true},
{map[string]string{"test-key": "test-value", "key2": "value2", "more": "more"}, true},
{map[string]string{"test-key": "test-value"}, false},
{map[string]string{"key2": "value2"}, false},
{map[string]string{"test-key": "test-value2", "key2": "value2"}, false},
} {
if matcher.Matches(context.Background(), protocol.CommonHeader(c.requestHeader)) != c.matched {
t.Errorf("No. %d case test failed", idx)
}
}
})
t.Run("regex header macth", func(t *testing.T) {
headersConfig := []v2.HeaderMatcher{
{
Name: "regexkey",
Value: ".*",
Regex: true,
},
}
matcher := CreateHTTPHeaderMatcher(headersConfig)
if !matcher.Matches(context.Background(), protocol.CommonHeader(map[string]string{"regexkey": "any"})) {
t.Errorf("regex header match failed")
}
})
t.Run("invalid regex header config", func(t *testing.T) {
headersConfig := []v2.HeaderMatcher{
{
Name: "regexkey",
Value: "a)", // invalid regexp
Regex: true,
},
}
matcher := CreateHTTPHeaderMatcher(headersConfig)
mimpl := matcher.(*httpHeaderMatcherImpl)
if len(mimpl.headers) != 0 {
t.Errorf("invalid regexkey should be ignored")
}
})
t.Run("http method test", func(t *testing.T) {
headersConfig := []v2.HeaderMatcher{
{
Name: "method",
Value: "POST",
},
{
Name: "common-key",
Value: "common-value",
},
}
ctx := variable.NewVariableContext(context.Background())
variable.SetString(ctx, types.VarMethod, "POST")
matcher := CreateHTTPHeaderMatcher(headersConfig)
for idx, c := range []struct {
requestHeader map[string]string
ctx context.Context
matched bool
}{
{
// method in request header will be ignored.
requestHeader: map[string]string{"common-key": "common-value", "method": "POST"},
ctx: context.Background(),
matched: false,
},
{
requestHeader: map[string]string{"common-key": "common-value"},
// method should be setted in the variables by the protocol stream modules
ctx: ctx,
matched: true,
},
{
requestHeader: map[string]string{"method": "POST"},
ctx: ctx, // only method matched, but headers not
matched: false,
},
} {
if matcher.Matches(c.ctx, protocol.CommonHeader(c.requestHeader)) != c.matched {
t.Errorf("No. %d case test failed", idx)
}
}
})
} | explode_data.jsonl/46018 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 1232
} | [
2830,
3393,
98752,
8331,
1155,
353,
8840,
836,
8,
341,
3244,
16708,
445,
22944,
1758,
4247,
2432,
497,
2915,
1155,
353,
8840,
836,
8,
341,
197,
67378,
2648,
1669,
3056,
85,
17,
15753,
37554,
515,
298,
197,
515,
571,
21297,
25,
220,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
func TestCmdMethod(t *testing.T) {
t.Parallel()
tests := []struct {
name string
cmd interface{}
method string
err error
}{
{
name: "unregistered type",
cmd: (*int)(nil),
err: btcjson.Error{ErrorCode: btcjson.ErrUnregisteredMethod},
},
{
name: "nil pointer of registered type",
cmd: (*btcjson.GetBlockCmd)(nil),
method: "getblock",
},
{
name: "nil instance of registered type",
cmd: &btcjson.GetBlockCountCmd{},
method: "getblockcount",
},
}
t.Logf("Running %d tests", len(tests))
for i, test := range tests {
method, err := btcjson.CmdMethod(test.cmd)
if reflect.TypeOf(err) != reflect.TypeOf(test.err) {
t.Errorf("Test #%d (%s) wrong error - got %T (%[3]v), "+
"want %T", i, test.name, err, test.err)
continue
}
if err != nil {
gotErrorCode := err.(btcjson.Error).ErrorCode
if gotErrorCode != test.err.(btcjson.Error).ErrorCode {
t.Errorf("Test #%d (%s) mismatched error code "+
"- got %v (%v), want %v", i, test.name,
gotErrorCode, err,
test.err.(btcjson.Error).ErrorCode)
continue
}
continue
}
// Ensure method matches the expected value.
if method != test.method {
t.Errorf("Test #%d (%s) mismatched method - got %v, "+
"want %v", i, test.name, method, test.method)
continue
}
}
} | explode_data.jsonl/27517 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 578
} | [
2830,
3393,
15613,
3523,
1155,
353,
8840,
836,
8,
341,
3244,
41288,
7957,
2822,
78216,
1669,
3056,
1235,
341,
197,
11609,
256,
914,
198,
197,
25920,
262,
3749,
16094,
197,
42257,
914,
198,
197,
9859,
262,
1465,
198,
197,
59403,
197,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 6 |
func TestValidateRWSetAndCollectionForDeploy(t *testing.T) {
var err error
chid := "ch"
ccid := "mycc"
ccver := "1.0"
cdRWSet := &ccprovider.ChaincodeData{Name: ccid, Version: ccver}
state := make(map[string]map[string][]byte)
state["lscc"] = make(map[string][]byte)
v := newValidationInstance(state)
ac := capabilities.NewApplicationProvider(map[string]*common.Capability{
capabilities.ApplicationV1_1: {},
})
lsccFunc := lscc.DEPLOY
// Test 1: More than two entries in the rwset -> error
rwset := &kvrwset.KVRWSet{Writes: []*kvrwset.KVWrite{{Key: ccid}, {Key: "b"}, {Key: "c"}}}
err = v.validateRWSetAndCollection(rwset, cdRWSet, nil, lsccFunc, ac, chid)
assert.EqualError(t, err, "LSCC can only issue one or two putState upon deploy")
// Test 2: Invalid key for the collection config package -> error
rwset = &kvrwset.KVRWSet{Writes: []*kvrwset.KVWrite{{Key: ccid}, {Key: "b"}}}
err = v.validateRWSetAndCollection(rwset, cdRWSet, nil, lsccFunc, ac, chid)
assert.EqualError(t, err, "invalid key for the collection of chaincode mycc:1.0; expected 'mycc~collection', received 'b'")
// Test 3: No collection config package -> success
rwset = &kvrwset.KVRWSet{Writes: []*kvrwset.KVWrite{{Key: ccid}}}
err = v.validateRWSetAndCollection(rwset, cdRWSet, nil, lsccFunc, ac, chid)
assert.NoError(t, err)
lsccargs := [][]byte{nil, nil, nil, nil, nil, nil}
err = v.validateRWSetAndCollection(rwset, cdRWSet, lsccargs, lsccFunc, ac, chid)
assert.NoError(t, err)
// Test 4: Valid key for the collection config package -> success
rwset = &kvrwset.KVRWSet{Writes: []*kvrwset.KVWrite{{Key: ccid}, {Key: privdata.BuildCollectionKVSKey(ccid)}}}
err = v.validateRWSetAndCollection(rwset, cdRWSet, lsccargs, lsccFunc, ac, chid)
assert.NoError(t, err)
// Test 5: Collection configuration of the lscc args doesn't match the rwset
lsccargs = [][]byte{nil, nil, nil, nil, nil, []byte("barf")}
err = v.validateRWSetAndCollection(rwset, cdRWSet, lsccargs, lsccFunc, ac, chid)
assert.EqualError(t, err, "collection configuration arguments supplied for chaincode mycc:1.0 do not match the configuration in the lscc writeset")
// Test 6: Invalid collection config package -> error
rwset = &kvrwset.KVRWSet{Writes: []*kvrwset.KVWrite{{Key: ccid}, {Key: privdata.BuildCollectionKVSKey("mycc"), Value: []byte("barf")}}}
err = v.validateRWSetAndCollection(rwset, cdRWSet, lsccargs, lsccFunc, ac, chid)
assert.EqualError(t, err, "invalid collection configuration supplied for chaincode mycc:1.0")
// Test 7: Valid collection config package -> success
collName1 := "mycollection1"
collName2 := "mycollection2"
var signers = [][]byte{[]byte("signer0"), []byte("signer1")}
policyEnvelope := cauthdsl.Envelope(cauthdsl.Or(cauthdsl.SignedBy(0), cauthdsl.SignedBy(1)), signers)
var requiredPeerCount, maximumPeerCount int32
var blockToLive uint64
requiredPeerCount = 1
maximumPeerCount = 2
blockToLive = 10000
coll1 := createCollectionConfig(collName1, policyEnvelope, requiredPeerCount, maximumPeerCount, blockToLive)
coll2 := createCollectionConfig(collName2, policyEnvelope, requiredPeerCount, maximumPeerCount, blockToLive)
err = testValidateCollection(t, v, []*peer.CollectionConfig{coll1, coll2}, cdRWSet, lsccFunc, ac, chid)
assert.NoError(t, err)
// Test 8: Duplicate collections in the collection config package -> success as the peer is in v1.1 validation mode
err = testValidateCollection(t, v, []*peer.CollectionConfig{coll1, coll2, coll1}, cdRWSet, lsccFunc, ac, chid)
assert.NoError(t, err)
// Test 9: requiredPeerCount > maximumPeerCount -> success as the peer is in v1.1 validation mode
collName3 := "mycollection3"
requiredPeerCount = 2
maximumPeerCount = 1
blockToLive = 10000
coll3 := createCollectionConfig(collName3, policyEnvelope, requiredPeerCount, maximumPeerCount, blockToLive)
err = testValidateCollection(t, v, []*peer.CollectionConfig{coll1, coll2, coll3}, cdRWSet, lsccFunc, ac, chid)
assert.NoError(t, err)
// Enable v1.2 validation mode
ac = capabilities.NewApplicationProvider(map[string]*common.Capability{
capabilities.ApplicationV1_2: {},
})
// Test 10: Duplicate collections in the collection config package -> error
err = testValidateCollection(t, v, []*peer.CollectionConfig{coll1, coll2, coll1}, cdRWSet, lsccFunc, ac, chid)
assert.EqualError(t, err, "collection-name: mycollection1 -- found duplicate collection configuration")
// Test 11: requiredPeerCount < 0 -> error
requiredPeerCount = -2
maximumPeerCount = 1
blockToLive = 10000
coll3 = createCollectionConfig(collName3, policyEnvelope, requiredPeerCount, maximumPeerCount, blockToLive)
err = testValidateCollection(t, v, []*peer.CollectionConfig{coll1, coll2, coll3}, cdRWSet, lsccFunc, ac, chid)
assert.EqualError(t, err, "collection-name: mycollection3 -- requiredPeerCount (1) cannot be less than zero (-2)",
collName3, maximumPeerCount, requiredPeerCount)
// Test 11: requiredPeerCount > maximumPeerCount -> error
requiredPeerCount = 2
maximumPeerCount = 1
blockToLive = 10000
coll3 = createCollectionConfig(collName3, policyEnvelope, requiredPeerCount, maximumPeerCount, blockToLive)
err = testValidateCollection(t, v, []*peer.CollectionConfig{coll1, coll2, coll3}, cdRWSet, lsccFunc, ac, chid)
assert.EqualError(t, err, "collection-name: mycollection3 -- maximum peer count (1) cannot be less than the required peer count (2)")
// Test 12: AND concatenation of orgs in access policy -> error
requiredPeerCount = 1
maximumPeerCount = 2
policyEnvelope = cauthdsl.Envelope(cauthdsl.And(cauthdsl.SignedBy(0), cauthdsl.SignedBy(1)), signers)
coll3 = createCollectionConfig(collName3, policyEnvelope, requiredPeerCount, maximumPeerCount, blockToLive)
err = testValidateCollection(t, v, []*peer.CollectionConfig{coll3}, cdRWSet, lsccFunc, ac, chid)
assert.EqualError(t, err, "collection-name: mycollection3 -- error in member org policy: signature policy is not an OR concatenation, NOutOf 2")
// Test 13: deploy with existing collection config on the ledger -> error
ccp := &peer.CollectionConfigPackage{Config: []*peer.CollectionConfig{coll1}}
ccpBytes, err := proto.Marshal(ccp)
assert.NoError(t, err)
state["lscc"][privdata.BuildCollectionKVSKey(ccid)] = ccpBytes
err = testValidateCollection(t, v, []*peer.CollectionConfig{coll1}, cdRWSet, lsccFunc, ac, chid)
assert.EqualError(t, err, "collection data should not exist for chaincode mycc:1.0")
} | explode_data.jsonl/42513 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 2244
} | [
2830,
3393,
17926,
56368,
1649,
3036,
6482,
2461,
69464,
1155,
353,
8840,
836,
8,
341,
2405,
1848,
1465,
198,
23049,
307,
1669,
330,
331,
698,
63517,
307,
1669,
330,
2408,
638,
698,
63517,
423,
1669,
330,
16,
13,
15,
698,
72826,
56368... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestAttrsReadV2Pretty(t *testing.T) {
c := setupTest([]string{"get", "attrs", "--host", "orion", "--id", "airqualityobserved1", "--attrs", "CO", "--pretty"})
reqRes := helper.MockHTTPReqRes{}
reqRes.Res.StatusCode = http.StatusOK
reqRes.ResBody = []byte(`{"CO":{"type":"Number","value":400.463869544,"metadata":{}}}`)
reqRes.Path = "/v2/entities/airqualityobserved1/attrs"
helper.SetClientHTTP(c, reqRes)
err := attrsRead(c, c.Ngsi, c.Client)
if assert.NoError(t, err) {
actual := helper.GetStdoutString(c)
expected := "{\n \"CO\": {\n \"type\": \"Number\",\n \"value\": 400.463869544,\n \"metadata\": {}\n }\n}\n"
assert.Equal(t, expected, actual)
}
} | explode_data.jsonl/33057 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 287
} | [
2830,
3393,
53671,
4418,
53,
17,
51940,
1155,
353,
8840,
836,
8,
341,
1444,
1669,
6505,
2271,
10556,
917,
4913,
455,
497,
330,
20468,
497,
14482,
3790,
497,
330,
269,
290,
497,
14482,
307,
497,
330,
1310,
10473,
5481,
2771,
16,
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... | 2 |
func TestInvalidJsonForProduct(t *testing.T) {
reader := strings.NewReader("invalid json is invalid")
_, err := parseProducts(reader)
if err == nil ||
err.Error() != "Can't read product information: invalid character 'i' looking for beginning of value - invalid json is invalid" {
t.Fatalf("This is not the proper error we're expecting: %v", err)
}
} | explode_data.jsonl/43074 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 108
} | [
2830,
3393,
7928,
5014,
2461,
4816,
1155,
353,
8840,
836,
8,
341,
61477,
1669,
9069,
68587,
445,
11808,
2951,
374,
8318,
1138,
197,
6878,
1848,
1669,
4715,
17746,
21987,
692,
743,
1848,
621,
2092,
8244,
197,
9859,
6141,
368,
961,
330,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
func TestVault(t *testing.T) {
vault := createTestVault(t)
Convey("Vault", t, func() {
binaryContent := []byte{0x0, 0xe8, 0x03, 0xd0, 0x07}
fooSecretData := map[string]interface{}{
"secret": "bar",
"binary": binaryContent,
}
_, err := vault.Write("kv/data/foo", map[string]interface{}{
"data": fooSecretData,
})
So(err, ShouldBeNil)
Convey("GetWrappingToken", func() {
Convey("returns token", func() {
token, err := vault.GetWrappingToken()
So(err, ShouldBeNil)
So(token, ShouldNotEqual, vault.token)
})
})
Convey("Encrypt and Decrypt", func() {
toEncrypt := []byte("to-encrypt")
encrypted, err := vault.Encrypt("my-trans", toEncrypt)
So(err, ShouldBeNil)
So(encrypted, ShouldNotResemble, toEncrypt)
decrypted, err := vault.Decrypt("my-trans", encrypted)
So(err, ShouldBeNil)
So(decrypted, ShouldResemble, toEncrypt)
})
Convey("GetMap", func() {
Convey("returns path as map of strings", func() {
list, err := vault.GetMap("kv/data/foo")
So(err, ShouldBeNil)
So(list, ShouldResemble, map[string]interface{}{
"secret": "bar",
"binary": base64.StdEncoding.EncodeToString(binaryContent),
})
})
})
Convey("List", func() {
Convey("returns keys as strings", func() {
list, err := vault.ListPath("kv/metadata")
So(err, ShouldBeNil)
So(list, ShouldResemble, []string{"foo"})
})
})
})
} | explode_data.jsonl/20996 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 611
} | [
2830,
3393,
79177,
1155,
353,
8840,
836,
8,
341,
5195,
945,
1669,
1855,
2271,
79177,
1155,
692,
93070,
5617,
445,
79177,
497,
259,
11,
2915,
368,
341,
197,
2233,
3287,
2762,
1669,
3056,
3782,
90,
15,
87,
15,
11,
220,
15,
8371,
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 TestOrdererV142(t *testing.T) {
op := NewOrdererProvider(map[string]*cb.Capability{
OrdererV1_4_2: {},
})
assert.NoError(t, op.Supported())
assert.True(t, op.PredictableChannelTemplate())
assert.True(t, op.Resubmission())
assert.True(t, op.ExpirationCheck())
assert.True(t, op.ConsensusTypeMigration())
assert.False(t, op.UseChannelCreationPolicyAsAdmins())
} | explode_data.jsonl/13885 | {
"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,
4431,
261,
53,
16,
19,
17,
1155,
353,
8840,
836,
8,
341,
39703,
1669,
1532,
4431,
261,
5179,
9147,
14032,
8465,
7221,
78963,
2897,
515,
197,
197,
4431,
261,
53,
16,
62,
19,
62,
17,
25,
14573,
197,
3518,
6948,
35699,
11... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func Test_getCPULimit_Kubernetes(t *testing.T) {
tests := []struct {
title string
limitValue string
expectedLimit string
wantAvailable bool
}{
{
title: "Override test - Kubernetes environment variables present and limit is set",
limitValue: "250",
expectedLimit: "250m",
wantAvailable: true,
},
{
title: "Defaults test - Kubernetes environment variables present and limit is unset",
limitValue: "",
expectedLimit: "",
wantAvailable: false,
},
}
for _, test := range tests {
t.Run(test.title, func(t *testing.T) {
os.Setenv("KUBERNETES_SERVICE_PORT", "6443")
os.Setenv("function_cpu_limit_milli", test.limitValue)
limit := getCPULimit()
if limit.Available != test.wantAvailable {
t.Errorf("Limits not available, want: %v, got: %v", test.wantAvailable, limit.Available)
}
if limit.Limit != test.expectedLimit {
t.Errorf("Limits not correct, want: `%v` got: `%v`.", test.expectedLimit, limit.Limit)
}
})
}
} | explode_data.jsonl/11980 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 412
} | [
2830,
3393,
3062,
7123,
1094,
2353,
10102,
29827,
1155,
353,
8840,
836,
8,
341,
78216,
1669,
3056,
1235,
341,
197,
24751,
260,
914,
198,
197,
8810,
2353,
1130,
262,
914,
198,
197,
42400,
16527,
914,
198,
197,
50780,
16485,
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 TestConvertColumn(t *testing.T) {
t.Run("missingPrimaryKey", func(t *testing.T) {
columnData := model.ColumnData{
Db: "user",
Table: "user",
Columns: []*model.Column{
{
DbColumn: &model.DbColumn{
Name: "id",
DataType: "bigint",
},
},
},
}
_, err := columnData.Convert()
assert.NotNil(t, err)
assert.Contains(t, err.Error(), "missing primary key")
})
t.Run("jointPrimaryKey", func(t *testing.T) {
columnData := model.ColumnData{
Db: "user",
Table: "user",
Columns: []*model.Column{
{
DbColumn: &model.DbColumn{
Name: "id",
DataType: "bigint",
},
Index: &model.DbIndex{
IndexName: "PRIMARY",
},
},
{
DbColumn: &model.DbColumn{
Name: "mobile",
DataType: "varchar",
Comment: "手机号",
},
Index: &model.DbIndex{
IndexName: "PRIMARY",
},
},
},
}
_, err := columnData.Convert()
assert.NotNil(t, err)
assert.Contains(t, err.Error(), "joint primary key is not supported")
})
t.Run("normal", func(t *testing.T) {
columnData := model.ColumnData{
Db: "user",
Table: "user",
Columns: []*model.Column{
{
DbColumn: &model.DbColumn{
Name: "id",
DataType: "bigint",
Extra: "auto_increment",
},
Index: &model.DbIndex{
IndexName: "PRIMARY",
SeqInIndex: 1,
},
},
{
DbColumn: &model.DbColumn{
Name: "mobile",
DataType: "varchar",
Comment: "手机号",
},
Index: &model.DbIndex{
IndexName: "mobile_unique",
SeqInIndex: 1,
},
},
},
}
table, err := columnData.Convert()
assert.Nil(t, err)
assert.True(t, table.PrimaryKey.Index.IndexName == "PRIMARY" && table.PrimaryKey.Name == "id")
for _, item := range table.Columns {
if item.Name == "mobile" {
assert.True(t, item.Index.NonUnique == 0)
break
}
}
})
} | explode_data.jsonl/25575 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 1008
} | [
2830,
3393,
12012,
2933,
1155,
353,
8840,
836,
8,
341,
3244,
16708,
445,
30616,
25981,
497,
2915,
1155,
353,
8840,
836,
8,
341,
197,
51661,
1043,
1669,
1614,
6153,
1043,
515,
298,
197,
7994,
25,
262,
330,
872,
756,
298,
197,
2556,
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 TestDelete(t *testing.T) {
cache := New("Example_Cache", func(key Key) (interface{}, error) {
if key.String() == "error" {
return nil, fmt.Errorf("some error")
}
return fmt.Sprintf("Value_for_key_%s", key), nil
})
defer cache.Close()
_, err := cache.Get(NewStringKey("Key1"))
if err != nil {
test.Failf(t, "Error returned: %s", err)
}
_, ok := cache.m.Load("Key1")
if !ok {
test.Failf(t, "value not exist in map")
}
cache.Delete(NewStringKey("Key1"))
_, ok = cache.m.Load("Key1")
if ok {
test.Failf(t, "value exist in map after delete")
}
} | explode_data.jsonl/2253 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 241
} | [
2830,
3393,
6435,
1155,
353,
8840,
836,
8,
1476,
52680,
1669,
1532,
445,
13314,
920,
1777,
497,
2915,
4857,
5309,
8,
320,
4970,
22655,
1465,
8,
341,
197,
743,
1376,
6431,
368,
621,
330,
841,
1,
341,
298,
853,
2092,
11,
8879,
13080,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestWithCapabilities(t *testing.T) {
bp := newBaseProcessor(testFullName)
assert.True(t, bp.GetCapabilities().MutatesConsumedData)
bp = newBaseProcessor(testFullName, WithCapabilities(component.ProcessorCapabilities{MutatesConsumedData: false}))
assert.False(t, bp.GetCapabilities().MutatesConsumedData)
} | explode_data.jsonl/4010 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 103
} | [
2830,
3393,
2354,
55315,
1155,
353,
8840,
836,
8,
341,
2233,
79,
1669,
501,
3978,
22946,
8623,
36217,
340,
6948,
32443,
1155,
11,
26685,
2234,
55315,
1005,
51440,
973,
41966,
291,
1043,
692,
2233,
79,
284,
501,
3978,
22946,
8623,
36217,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestMacServiceImpl_IsExist(t *testing.T) {
a := assert.New(t)
ctrl := gomock.NewController(t)
defer ctrl.Finish()
mockMr := database.NewMockMacRepository(ctrl)
input := &model.Mac{}
// mock output
eIsExist := true
eID := uint(1)
eT := time.Now()
{
// success
mpi := NewMacServiceImpl(mockMr)
if mpi == nil {
t.FailNow()
}
mockMr.EXPECT().IsExist(input).Return(eIsExist, eID, eT, nil)
aIsExist, aID, aT, err := mpi.IsExist(input)
a.NoError(err)
a.Equal(eIsExist, aIsExist)
a.Equal(eID, aID)
a.Equal(eT, aT)
}
{
// failed
mpi := NewMacServiceImpl(mockMr)
if mpi == nil {
t.FailNow()
}
mockMr.EXPECT().IsExist(input).Return(false, uint(0), time.Time{}, fmt.Errorf("error"))
aIsExist, aID, aT, err := mpi.IsExist(input)
a.Error(err)
a.False(aIsExist)
a.Equal(uint(0), aID)
a.Equal(time.Time{}, aT)
}
} | explode_data.jsonl/55038 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 430
} | [
2830,
3393,
19552,
50603,
31879,
25613,
1155,
353,
8840,
836,
8,
341,
11323,
1669,
2060,
7121,
1155,
340,
84381,
1669,
342,
316,
1176,
7121,
2051,
1155,
340,
16867,
23743,
991,
18176,
741,
77333,
12275,
1669,
4625,
7121,
11571,
19552,
462... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestSummaryWithHTMLTagsOnNextLine(t *testing.T) {
assertFunc := func(t *testing.T, ext string, pages page.Pages) {
p := pages[0]
require.Contains(t, p.Summary(), "Happy new year everyone!")
require.NotContains(t, p.Summary(), "User interface")
}
testAllMarkdownEnginesForPages(t, assertFunc, nil, `---
title: Simple
---
Happy new year everyone!
Here is the last report for commits in the year 2016. It covers hrev50718-hrev50829.
<!--more-->
<h3>User interface</h3>
`)
} | explode_data.jsonl/60618 | {
"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,
19237,
2354,
5835,
15930,
1925,
5847,
2460,
1155,
353,
8840,
836,
8,
1476,
6948,
9626,
1669,
2915,
1155,
353,
8840,
836,
11,
1303,
914,
11,
6816,
2150,
68829,
8,
341,
197,
3223,
1669,
6816,
58,
15,
921,
197,
17957,
11545,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestBlocks(t *testing.T) {
tests := []struct {
code string
expressions string
}{
{"{ bark() }", "bark()"},
{"{ bark()\nbite() }", "bark()bite()"},
}
for _, test := range tests {
t.Run(test.code, func(t *testing.T) {
l := lexer.New(test.code)
p := New(l)
if expr := p.parseBlock(); expr.String() != test.expressions {
t.Fatalf("parseBlock(%q) = %q, want %q", test.code, expr.String(), test.expressions)
}
})
}
} | explode_data.jsonl/81340 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 204
} | [
2830,
3393,
29804,
1155,
353,
8840,
836,
8,
341,
78216,
1669,
3056,
1235,
341,
197,
43343,
286,
914,
198,
197,
8122,
39873,
914,
198,
197,
59403,
197,
197,
4913,
90,
53742,
368,
335,
497,
330,
65,
838,
368,
7115,
197,
197,
4913,
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... | 2 |
func TestPlayer_HasHelmet(t *testing.T) {
pl := playerWithProperty("m_bHasHelmet", st.PropertyValue{IntVal: 0})
assert.False(t, pl.HasHelmet())
pl = playerWithProperty("m_bHasHelmet", st.PropertyValue{IntVal: 1})
assert.True(t, pl.HasHelmet())
} | explode_data.jsonl/12186 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 95
} | [
2830,
3393,
4476,
2039,
300,
87266,
1155,
353,
8840,
836,
8,
341,
72213,
1669,
2781,
2354,
3052,
445,
76,
880,
10281,
87266,
497,
357,
15727,
1130,
90,
1072,
2208,
25,
220,
15,
8824,
6948,
50757,
1155,
11,
625,
16152,
87266,
12367,
72... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestStoreCreditCard(t *testing.T) {
c, _ := NewClient(testClientID, testSecret, APIBaseSandBox)
c.GetAccessToken()
r1, e1 := c.StoreCreditCard(CreditCard{})
if e1 == nil || r1 != nil {
t.Errorf("Error is expected for invalid CC")
}
r2, e2 := c.StoreCreditCard(CreditCard{
Number: "4417119669820331",
Type: "visa",
ExpireMonth: "11",
ExpireYear: "2020",
CVV2: "874",
FirstName: "Foo",
LastName: "Bar",
})
if e2 != nil || r2 == nil {
t.Errorf("200 code expected for valid CC card. Error: %v", e2)
}
} | explode_data.jsonl/18456 | {
"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,
6093,
33493,
5770,
1155,
353,
8840,
836,
8,
341,
1444,
11,
716,
1669,
1532,
2959,
8623,
2959,
915,
11,
1273,
19773,
11,
5333,
3978,
47044,
1611,
340,
1444,
2234,
37649,
2822,
7000,
16,
11,
384,
16,
1669,
272,
38047,
33493,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestInt64(t *testing.T) {
t.Run("int64", func() func(t *testing.T) {
input := signal.Allocator{
Channels: 3,
Capacity: 3,
Length: 3,
}.Int64(signal.BitDepth64)
signal.WriteStripedInt64(
[][]int64{
{},
{1, 2, 3},
{11, 12, 13, 14},
},
input,
)
result := signal.Allocator{
Channels: 3,
Capacity: 2,
}.Int64(signal.BitDepth64)
result.Append(input.Slice(1, 3))
return testOk(
result,
expected{
length: 2,
capacity: 2,
data: [][]int64{
{0, 0},
{2, 3},
{12, 13},
},
},
)
}())
} | explode_data.jsonl/70620 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 322
} | [
2830,
3393,
1072,
21,
19,
1155,
353,
8840,
836,
8,
341,
3244,
16708,
445,
396,
21,
19,
497,
2915,
368,
2915,
1155,
353,
8840,
836,
8,
341,
197,
22427,
1669,
8286,
9636,
68033,
515,
298,
197,
35925,
25,
220,
18,
345,
298,
6258,
391... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestLoadModeStrings(t *testing.T) {
testcases := []struct {
mode packages.LoadMode
expected string
}{
{
packages.LoadMode(0),
"LoadMode(0)",
},
{
packages.NeedName,
"LoadMode(NeedName)",
},
{
packages.NeedFiles,
"LoadMode(NeedFiles)",
},
{
packages.NeedCompiledGoFiles,
"LoadMode(NeedCompiledGoFiles)",
},
{
packages.NeedImports,
"LoadMode(NeedImports)",
},
{
packages.NeedDeps,
"LoadMode(NeedDeps)",
},
{
packages.NeedExportFile,
"LoadMode(NeedExportFile)",
},
{
packages.NeedTypes,
"LoadMode(NeedTypes)",
},
{
packages.NeedSyntax,
"LoadMode(NeedSyntax)",
},
{
packages.NeedTypesInfo,
"LoadMode(NeedTypesInfo)",
},
{
packages.NeedTypesSizes,
"LoadMode(NeedTypesSizes)",
},
{
packages.NeedName | packages.NeedExportFile,
"LoadMode(NeedName|NeedExportFile)",
},
{
packages.NeedName | packages.NeedFiles | packages.NeedCompiledGoFiles | packages.NeedImports | packages.NeedDeps | packages.NeedExportFile | packages.NeedTypes | packages.NeedSyntax | packages.NeedTypesInfo | packages.NeedTypesSizes,
"LoadMode(NeedName|NeedFiles|NeedCompiledGoFiles|NeedImports|NeedDeps|NeedExportFile|NeedTypes|NeedSyntax|NeedTypesInfo|NeedTypesSizes)",
},
{
packages.NeedName | 8192,
"LoadMode(NeedName|Unknown)",
},
{
4096,
"LoadMode(Unknown)",
},
}
for tcInd, tc := range testcases {
t.Run(fmt.Sprintf("test-%d", tcInd), func(t *testing.T) {
actual := tc.mode.String()
if tc.expected != actual {
t.Errorf("want %#v, got %#v", tc.expected, actual)
}
})
}
} | explode_data.jsonl/52468 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 695
} | [
2830,
3393,
5879,
3636,
20859,
1155,
353,
8840,
836,
8,
341,
18185,
23910,
1669,
3056,
1235,
341,
197,
60247,
257,
14185,
13969,
3636,
198,
197,
42400,
914,
198,
197,
59403,
197,
197,
515,
298,
3223,
22211,
13969,
3636,
7,
15,
1326,
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 TestDisallowedCharacters(t *testing.T) {
for i, tt := range characterTests {
d := NewDecoder(strings.NewReader(tt.in))
var err error
for err == nil {
_, err = d.Token()
}
synerr, ok := err.(*SyntaxError)
if !ok {
t.Fatalf("input %d d.Token() = _, %v, want _, *SyntaxError", i, err)
}
if synerr.Msg != tt.err {
t.Fatalf("input %d synerr.Msg wrong: want %q, got %q", i, tt.err, synerr.Msg)
}
}
} | explode_data.jsonl/48624 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 199
} | [
2830,
3393,
4839,
20967,
37489,
1155,
353,
8840,
836,
8,
1476,
2023,
600,
11,
17853,
1669,
2088,
3668,
18200,
341,
197,
2698,
1669,
1532,
20732,
51442,
68587,
47152,
1858,
1171,
197,
2405,
1848,
1465,
271,
197,
2023,
1848,
621,
2092,
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... | 5 |
func TestWantlistClearsOnCancel(t *testing.T) {
ctx, cancel := context.WithTimeout(context.Background(), time.Second*5)
defer cancel()
vnet := getVirtualNetwork()
sesgen := NewTestSessionGenerator(vnet)
defer sesgen.Close()
bgen := blocksutil.NewBlockGenerator()
blks := bgen.Blocks(10)
var cids []*cid.Cid
for _, blk := range blks {
cids = append(cids, blk.Cid())
}
inst := sesgen.Instances(1)
a := inst[0]
ctx1, cancel1 := context.WithCancel(ctx)
ses := a.Exchange.NewSession(ctx1)
_, err := ses.GetBlocks(ctx, cids)
if err != nil {
t.Fatal(err)
}
cancel1()
if err := tu.WaitFor(ctx, func() error {
if len(a.Exchange.GetWantlist()) > 0 {
return fmt.Errorf("expected empty wantlist")
}
return nil
}); err != nil {
t.Fatal(err)
}
} | explode_data.jsonl/48082 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 321
} | [
2830,
3393,
28823,
1607,
14008,
82,
1925,
9269,
1155,
353,
8840,
836,
8,
341,
20985,
11,
9121,
1669,
2266,
26124,
7636,
5378,
19047,
1507,
882,
32435,
9,
20,
340,
16867,
9121,
2822,
5195,
4711,
1669,
633,
33026,
12320,
741,
1903,
288,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestNameWhitelistSign(t *testing.T) {
csrPEM, err := ioutil.ReadFile(fullSubjectCSR)
if err != nil {
t.Fatalf("%v", err)
}
subInvalid := &signer.Subject{
CN: "localhost.com",
}
subValid := &signer.Subject{
CN: "1lab41.cf",
}
wl := regexp.MustCompile("^1[a-z]*[0-9]*\\.cf$")
s := newCustomSigner(t, testECDSACaFile, testECDSACaKeyFile)
// Whitelist only key-related fields. Subject, DNSNames, etc shouldn't get
// passed through from CSR.
s.policy = &config.Signing{
Default: &config.SigningProfile{
Usage: []string{"cert sign", "crl sign"},
ExpiryString: "1h",
Expiry: 1 * time.Hour,
CAConstraint: config.CAConstraint{IsCA: true},
NameWhitelist: wl,
},
}
request := signer.SignRequest{
Hosts: []string{"127.0.0.1", "1machine23.cf"},
Request: string(csrPEM),
}
_, err = s.Sign(request)
if err != nil {
t.Fatalf("%v", err)
}
request = signer.SignRequest{
Hosts: []string{"invalid.cf", "1machine23.cf"},
Request: string(csrPEM),
}
_, err = s.Sign(request)
if err == nil {
t.Fatalf("expected a policy error")
}
request = signer.SignRequest{
Hosts: []string{"1machine23.cf"},
Request: string(csrPEM),
Subject: subInvalid,
}
_, err = s.Sign(request)
if err == nil {
t.Fatalf("expected a policy error")
}
request = signer.SignRequest{
Hosts: []string{"1machine23.cf"},
Request: string(csrPEM),
Subject: subValid,
}
_, err = s.Sign(request)
if err != nil {
t.Fatalf("%v", err)
}
} | explode_data.jsonl/71289 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 661
} | [
2830,
3393,
675,
1639,
57645,
7264,
1155,
353,
8840,
836,
8,
341,
1444,
15094,
1740,
44,
11,
1848,
1669,
43144,
78976,
28907,
13019,
70022,
340,
743,
1848,
961,
2092,
341,
197,
3244,
30762,
4430,
85,
497,
1848,
340,
197,
630,
28624,
7... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 6 |
func TestDeviceService_Get_NotFound(t *testing.T) {
// Given
client, mux, cleanup := newFixture()
defer cleanup()
uuid := "123456789123456789"
mux.HandleFunc("/"+deviceBasePath, func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, http.MethodGet)
expected := "%24filter=uuid+eq+%27123456789123456789%27"
if r.URL.RawQuery != expected {
http.Error(w, fmt.Sprintf("query = %s ; expected %s", r.URL.RawQuery, expected), 500)
return
}
fmt.Fprint(w, `{"d":[]}`)
})
// When
device, err := client.Device.Get(context.Background(), DeviceUUID(uuid))
// Then
assert.NilError(t, err)
assert.Assert(t, device == nil)
} | explode_data.jsonl/46817 | {
"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,
6985,
1860,
13614,
60816,
6650,
1155,
353,
8840,
836,
8,
341,
197,
322,
16246,
198,
25291,
11,
59807,
11,
21290,
1669,
501,
18930,
741,
16867,
21290,
741,
10676,
2423,
1669,
330,
16,
17,
18,
19,
20,
21,
22,
23,
24,
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 TestScalarBls12377G1Mul(t *testing.T) {
bls12377G1 := BLS12377G1()
nine := bls12377G1.Scalar.New(9)
six := bls12377G1.Scalar.New(6)
actual := nine.Mul(six)
require.Equal(t, actual.Cmp(bls12377G1.Scalar.New(54)), 0)
n := new(big.Int).Set(bls12377modulus)
n.Sub(n, big.NewInt(1))
upper, err := bls12377G1.Scalar.SetBigInt(n)
require.NoError(t, err)
require.Equal(t, upper.Mul(upper).Cmp(bls12377G1.Scalar.New(1)), 0)
} | explode_data.jsonl/15757 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 223
} | [
2830,
3393,
20639,
33,
4730,
16,
17,
18,
22,
22,
38,
16,
59155,
1155,
353,
8840,
836,
8,
341,
96421,
82,
16,
17,
18,
22,
22,
38,
16,
1669,
425,
7268,
16,
17,
18,
22,
22,
38,
16,
741,
9038,
482,
1669,
1501,
82,
16,
17,
18,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestHealthCheck(t *testing.T) {
req := grpc_health_v1.HealthCheckRequest{Service: grpcHealthServiceName}
resp, err := healthClient.Check(ctx, &req)
if err != nil {
t.Fatal(err)
}
if resp == nil {
t.Fatal("Expected non-nil *HealthCheckResponse")
}
if resp.Status != grpc_health_v1.HealthCheckResponse_SERVING {
t.Fatalf("Expected health check to return SERVING status, got: %s", resp.Status.String())
}
} | explode_data.jsonl/61993 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 157
} | [
2830,
3393,
14542,
3973,
1155,
353,
8840,
836,
8,
341,
24395,
1669,
47900,
45727,
2273,
16,
74980,
3973,
1900,
90,
1860,
25,
47900,
14542,
1860,
675,
532,
34653,
11,
1848,
1669,
2820,
2959,
10600,
7502,
11,
609,
2958,
340,
743,
1848,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 4 |
func TestNotEnoughSessions(t *testing.T) {
reqUrl := createUrl("/wd/hub/firefox/missing/test/1/session")
resp, err := http.Post(
reqUrl,
"text/plain",
strings.NewReader("payload"),
)
AssertThat(t, err, Is{nil})
AssertThat(t, resp, Code{http.StatusBadRequest})
} | explode_data.jsonl/65291 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 110
} | [
2830,
3393,
2623,
95801,
59062,
1155,
353,
8840,
836,
8,
341,
24395,
2864,
1669,
1855,
2864,
4283,
6377,
7530,
392,
53010,
15011,
14,
30616,
12697,
14,
16,
54760,
1138,
34653,
11,
1848,
1669,
1758,
23442,
1006,
197,
24395,
2864,
345,
19... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestBlockSerializeErrors(t *testing.T) {
tests := []struct {
in *MsgBlock // Value to encode
buf []byte // Serialized data
max int // Max size of fixed buffer to induce errors
writeErr error // Expected write error
readErr error // Expected read error
}{
// Force error in version.
{&blockOne, blockOneBytes, 0, io.ErrShortWrite, io.EOF},
// Force error in prev block hash.
{&blockOne, blockOneBytes, 4, io.ErrShortWrite, io.EOF},
// Force error in merkle root.
{&blockOne, blockOneBytes, 36, io.ErrShortWrite, io.EOF},
// Force error in timestamp.
{&blockOne, blockOneBytes, 68, io.ErrShortWrite, io.EOF},
// Force error in difficulty bits.
{&blockOne, blockOneBytes, 72, io.ErrShortWrite, io.EOF},
// Force error in header nonce.
{&blockOne, blockOneBytes, 76, io.ErrShortWrite, io.EOF},
// Force error in transaction count.
{&blockOne, blockOneBytes, 80, io.ErrShortWrite, io.EOF},
// Force error in transactions.
{&blockOne, blockOneBytes, 81, io.ErrShortWrite, io.EOF},
}
t.Logf("Running %d tests", len(tests))
for i, test := range tests {
// Serialize the block.
w := newFixedWriter(test.max)
err := test.in.Serialize(w)
if err != test.writeErr {
t.Errorf("Serialize #%d wrong error got: %v, want: %v",
i, err, test.writeErr)
continue
}
// Deserialize the block.
var block MsgBlock
r := newFixedReader(test.max, test.buf)
err = block.Deserialize(r)
if err != test.readErr {
t.Errorf("Deserialize #%d wrong error got: %v, want: %v",
i, err, test.readErr)
continue
}
var txLocBlock MsgBlock
br := bytes.NewBuffer(test.buf[0:test.max])
_, err = txLocBlock.DeserializeTxLoc(br)
if err != test.readErr {
t.Errorf("DeserializeTxLoc #%d wrong error got: %v, want: %v",
i, err, test.readErr)
continue
}
}
} | explode_data.jsonl/16746 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 764
} | [
2830,
3393,
4713,
15680,
13877,
1155,
353,
8840,
836,
8,
341,
78216,
1669,
3056,
1235,
341,
197,
17430,
981,
353,
6611,
4713,
442,
5162,
311,
16164,
198,
197,
26398,
414,
3056,
3782,
262,
442,
91472,
821,
198,
197,
22543,
414,
526,
98... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestTraces(t *testing.T) {
tracesCh := make(chan pdata.Traces)
tracesAddr := traceutils.NewTestServer(t, func(t pdata.Traces) {
tracesCh <- t
})
tracesCfgText := util.Untab(fmt.Sprintf(`
configs:
- name: default
receivers:
jaeger:
protocols:
thrift_compact:
remote_write:
- endpoint: %s
insecure: true
batch:
timeout: 100ms
send_batch_size: 1
`, tracesAddr))
var cfg Config
dec := yaml.NewDecoder(strings.NewReader(tracesCfgText))
dec.SetStrict(true)
err := dec.Decode(&cfg)
require.NoError(t, err)
var loggingLevel logging.Level
require.NoError(t, loggingLevel.Set("debug"))
traces, err := New(nil, nil, prometheus.NewRegistry(), cfg, logrus.InfoLevel, logging.Format{})
require.NoError(t, err)
t.Cleanup(traces.Stop)
tr := testJaegerTracer(t)
span := tr.StartSpan("test-span")
span.Finish()
select {
case <-time.After(30 * time.Second):
require.Fail(t, "failed to receive a span after 30 seconds")
case tr := <-tracesCh:
require.Equal(t, 1, tr.SpanCount())
// Nothing to do, send succeeded.
}
} | explode_data.jsonl/74667 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 436
} | [
2830,
3393,
1282,
2434,
1155,
353,
8840,
836,
8,
341,
25583,
2434,
1143,
1669,
1281,
35190,
70311,
8240,
2434,
340,
25583,
2434,
13986,
1669,
11655,
6031,
7121,
2271,
5475,
1155,
11,
2915,
1155,
70311,
8240,
2434,
8,
341,
197,
25583,
24... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestSortedSet(t *testing.T) {
testRaw(t, func(c *client) {
c.Do("ZADD", "z", "1", "aap", "2", "noot", "3", "mies")
c.Do("ZADD", "z", "1", "vuur", "4", "noot")
c.Do("TYPE", "z")
c.Do("EXISTS", "z")
c.Do("ZCARD", "z")
c.Do("ZRANK", "z", "aap")
c.Do("ZRANK", "z", "noot")
c.Do("ZRANK", "z", "mies")
c.Do("ZRANK", "z", "vuur")
c.Do("ZRANK", "z", "nosuch")
c.Do("ZRANK", "nosuch", "nosuch")
c.Do("ZREVRANK", "z", "aap")
c.Do("ZREVRANK", "z", "noot")
c.Do("ZREVRANK", "z", "mies")
c.Do("ZREVRANK", "z", "vuur")
c.Do("ZREVRANK", "z", "nosuch")
c.Do("ZREVRANK", "nosuch", "nosuch")
c.Do("ZADD", "zi", "inf", "aap", "-inf", "noot", "+inf", "mies")
c.Do("ZRANK", "zi", "noot")
// Double key
c.Do("ZADD", "zz", "1", "aap", "2", "aap")
c.Do("ZCARD", "zz")
c.Do("ZPOPMAX", "zz", "2")
c.Do("ZPOPMAX", "zz")
c.Do("ZPOPMAX", "zz", "-100")
c.Do("ZPOPMAX", "nosuch", "1")
c.Do("ZPOPMAX", "zz", "100")
c.Do("ZPOPMIN", "zz", "2")
c.Do("ZPOPMIN", "zz")
c.Do("ZPOPMIN", "zz", "-100")
c.Do("ZPOPMIN", "nosuch", "1")
c.Do("ZPOPMIN", "zz", "100")
// failure cases
c.Do("SET", "str", "I am a string")
c.Error("wrong number", "ZADD")
c.Error("wrong number", "ZADD", "s")
c.Error("wrong number", "ZADD", "s", "1")
c.Error("syntax error", "ZADD", "s", "1", "aap", "1")
c.Error("not a valid float", "ZADD", "s", "nofloat", "aap")
c.Error("wrong kind", "ZADD", "str", "1", "aap")
c.Error("wrong number", "ZCARD")
c.Error("wrong number", "ZCARD", "too", "many")
c.Error("wrong kind", "ZCARD", "str")
c.Error("wrong number", "ZRANK")
c.Error("wrong number", "ZRANK", "key")
c.Error("wrong number", "ZRANK", "key", "too", "many")
c.Error("wrong kind", "ZRANK", "str", "member")
c.Error("wrong number", "ZREVRANK")
c.Error("wrong number", "ZREVRANK", "key")
c.Error("wrong number", "ZPOPMAX")
c.Error("not an integer", "ZPOPMAX", "set", "noint")
c.Error("syntax error", "ZPOPMAX", "set", "1", "toomany")
c.Error("wrong number", "ZPOPMIN")
c.Error("not an integer", "ZPOPMIN", "set", "noint")
c.Error("syntax error", "ZPOPMIN", "set", "1", "toomany")
c.Do("RENAME", "z", "z2")
c.Do("EXISTS", "z")
c.Do("EXISTS", "z2")
c.Do("MOVE", "z2", "3")
c.Do("EXISTS", "z2")
c.Do("SELECT", "3")
c.Do("EXISTS", "z2")
c.Do("DEL", "z2")
c.Do("EXISTS", "z2")
})
testRaw(t, func(c *client) {
c.Do("ZADD", "z", "0", "new\nline\n")
c.Do("ZADD", "z", "0", "line")
c.Do("ZADD", "z", "0", "another\nnew\nline\n")
c.Do("ZSCAN", "z", "0", "MATCH", "*")
c.Do("ZRANGEBYLEX", "z", "[a", "[z")
c.Do("ZRANGE", "z", "0", "-1", "WITHSCORES")
})
} | explode_data.jsonl/23340 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 1387
} | [
2830,
3393,
51051,
1649,
1155,
353,
8840,
836,
8,
341,
18185,
20015,
1155,
11,
2915,
1337,
353,
2972,
8,
341,
197,
1444,
33596,
445,
57,
15665,
497,
330,
89,
497,
330,
16,
497,
330,
64,
391,
497,
330,
17,
497,
330,
77,
1905,
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 TestRecoverParserRuntime(t *testing.T) {
p := newParser("foo bar")
var err error
defer func() {
require.Equal(t, errUnexpected, err)
}()
defer p.recover(&err)
// Cause a runtime panic.
var a []int
//nolint:govet
a[123] = 1
} | explode_data.jsonl/3395 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 101
} | [
2830,
3393,
693,
3688,
6570,
15123,
1155,
353,
8840,
836,
8,
341,
3223,
1669,
501,
6570,
445,
7975,
3619,
1138,
2405,
1848,
1465,
271,
16867,
2915,
368,
341,
197,
17957,
12808,
1155,
11,
1848,
29430,
11,
1848,
340,
197,
69826,
16867,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestPrivilege(t *testing.T) {
name := "SeShutdownPrivilege"
status := IsEnabled(name)
// Let's try to change permissions
if !Set("SeShutdownPrivilege", !status) {
t.Errorf("Change status '%v' privilege", name)
}
if IsEnabled(name) == status {
t.Errorf("Privilege '%v' was not changed", name)
}
// Revert perms back
if !Set("SeShutdownPrivilege", status) {
t.Errorf("Change status back '%v' privilege", name)
}
if IsEnabled(name) != status {
t.Errorf("Privilege '%v' was not changed back", name)
}
} | explode_data.jsonl/20906 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 221
} | [
2830,
3393,
32124,
42769,
1155,
353,
8840,
836,
8,
972,
11609,
1669,
330,
1514,
62004,
32124,
42769,
18591,
23847,
1669,
2160,
5462,
3153,
7229,
197,
322,
6771,
594,
1430,
311,
2297,
8541,
319,
743,
753,
1649,
445,
1514,
62004,
32124,
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... | 5 |
func TestBodyStorage(t *testing.T) {
db := NewMemoryDatabase()
// Create a test body to move around the database and make sure it's really new
body := &model.Body{Uncles: []*model.Header{{Extra: []byte("test header"), ClaudeCtxHash: &model.ClaudeContextHash{}}}}
hasher := sha3.NewLegacyKeccak256()
rlputil.Encode(hasher, body)
hash := common.BytesToHash(hasher.Sum(nil))
if entry := ReadBody(db, hash, 0); entry != nil {
t.Fatalf("Non existent body returned: %v", entry)
}
// Write and verify the body in the database
WriteBody(db, hash, 0, body)
if entry := ReadBody(db, hash, 0); entry == nil {
t.Fatalf("Stored body not found")
} else if model.DeriveSha(model.Transactions(entry.Transactions)) != model.DeriveSha(model.Transactions(body.Transactions)) || model.CalcUncleHash(entry.Uncles) != model.CalcUncleHash(body.Uncles) {
t.Fatalf("Retrieved body mismatch: have %v, want %v", entry, body)
}
if entry := ReadBodyRLP(db, hash, 0); entry == nil {
t.Fatalf("Stored body RLP not found")
} else {
hasher := sha3.NewLegacyKeccak256()
hasher.Write(entry)
if calc := common.BytesToHash(hasher.Sum(nil)); calc != hash {
t.Fatalf("Retrieved RLP body mismatch: have %v, want %v", entry, body)
}
}
// Delete the body and verify the execution
DeleteBody(db, hash, 0)
if entry := ReadBody(db, hash, 0); entry != nil {
t.Fatalf("Deleted body returned: %v", entry)
}
} | explode_data.jsonl/72780 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 510
} | [
2830,
3393,
5444,
5793,
1155,
353,
8840,
836,
8,
341,
20939,
1669,
1532,
10642,
5988,
2822,
197,
322,
4230,
264,
1273,
2487,
311,
3271,
2163,
279,
4625,
323,
1281,
2704,
432,
594,
2167,
501,
198,
35402,
1669,
609,
2528,
20934,
90,
637... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestUploadIncreasePartSize(t *testing.T) {
s, ops, args := loggingSvc(emptyList)
mgr := s3manager.NewUploaderWithClient(s, func(u *s3manager.Uploader) {
u.Concurrency = 1
u.MaxUploadParts = 2
})
_, err := mgr.Upload(&s3manager.UploadInput{
Bucket: aws.String("Bucket"),
Key: aws.String("Key"),
Body: bytes.NewReader(buf12MB),
})
if err != nil {
t.Errorf("Expected no error but received %v", err)
}
if int64(s3manager.DefaultDownloadPartSize) != mgr.PartSize {
t.Errorf("Expected %d, but received %d", s3manager.DefaultDownloadPartSize, mgr.PartSize)
}
vals := []string{"CreateMultipartUpload", "UploadPart", "UploadPart", "CompleteMultipartUpload"}
if !reflect.DeepEqual(vals, *ops) {
t.Errorf("Expected %v, but received %v", vals, *ops)
}
// Part lengths
if len := buflen(val((*args)[1], "Body")); (1024*1024*6)+1 != len {
t.Errorf("Expected %d, but received %d", (1024*1024*6)+1, len)
}
if len := buflen(val((*args)[2], "Body")); (1024*1024*6)-1 != len {
t.Errorf("Expected %d, but received %d", (1024*1024*6)-1, len)
}
} | explode_data.jsonl/55633 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 437
} | [
2830,
3393,
13844,
69556,
5800,
1695,
1155,
353,
8840,
836,
8,
341,
1903,
11,
27132,
11,
2827,
1669,
8392,
92766,
24216,
852,
340,
2109,
901,
1669,
274,
18,
13297,
7121,
67574,
2354,
2959,
1141,
11,
2915,
8154,
353,
82,
18,
13297,
608... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestGetType(t *testing.T) {
for _, ft := range []flow.Type{
flow.TypeAPI,
flow.TypeBrowser,
} {
t.Run(fmt.Sprintf("case=%s", ft), func(t *testing.T) {
r := &Flow{Type: ft}
assert.Equal(t, ft, r.GetType())
})
}
} | explode_data.jsonl/69429 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 114
} | [
2830,
3393,
58064,
1155,
353,
8840,
836,
8,
341,
2023,
8358,
10482,
1669,
2088,
3056,
4965,
10184,
515,
197,
1166,
10303,
10184,
7082,
345,
197,
1166,
10303,
10184,
17878,
345,
197,
92,
341,
197,
3244,
16708,
28197,
17305,
445,
5638,
78... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestBuildPipelinesWithUnresolvedImage(t *testing.T) {
dockerFile, err := app.NewDockerfile("FROM centos\nEXPOSE 1234\nEXPOSE 4567")
if err != nil {
t.Fatal(err)
}
sourceRepo, err := app.NewSourceRepository("https://github.com/foo/bar.git", newapp.StrategyDocker)
if err != nil {
t.Fatal(err)
}
sourceRepo.SetInfo(&app.SourceRepositoryInfo{
Dockerfile: dockerFile,
})
refs := app.ComponentReferences{
app.ComponentReference(&app.ComponentInput{
Value: "mysql",
Uses: sourceRepo,
ExpectToBuild: true,
ResolvedMatch: &app.ComponentMatch{
Value: "mysql",
},
}),
}
a := AppConfig{}
a.Out = &bytes.Buffer{}
group, err := a.buildPipelines(refs, app.Environment{}, app.Environment{})
if err != nil {
t.Error(err)
}
expectedPorts := sets.NewString("1234", "4567")
actualPorts := sets.NewString()
for port := range group[0].InputImage.Info.Config.ExposedPorts {
actualPorts.Insert(port)
}
if e, a := expectedPorts.List(), actualPorts.List(); !reflect.DeepEqual(e, a) {
t.Errorf("Expected ports=%v, got %v", e, a)
}
} | explode_data.jsonl/42187 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 453
} | [
2830,
3393,
11066,
47,
93997,
2354,
1806,
39747,
1906,
1155,
353,
8840,
836,
8,
341,
2698,
13659,
1703,
11,
1848,
1669,
906,
7121,
35,
13659,
1192,
445,
30093,
2889,
436,
1699,
3257,
7150,
220,
16,
17,
18,
19,
1699,
3257,
7150,
220,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 6 |
func TestDoc(t *testing.T) {
r, err := NewResource(appApiVersion, appKind)
if err != nil {
t.Fatal(err)
}
s, buf := setupScaffoldAndWriter()
err = s.Execute(appConfig, &Doc{Resource: r})
if err != nil {
t.Fatalf("failed to execute the scaffold: (%v)", err)
}
if docExp != buf.String() {
diffs := testutil.Diff(docExp, buf.String())
t.Fatalf("expected vs actual differs.\n%v", diffs)
}
} | explode_data.jsonl/60043 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 165
} | [
2830,
3393,
9550,
1155,
353,
8840,
836,
8,
341,
7000,
11,
1848,
1669,
1532,
4783,
11462,
6563,
5637,
11,
906,
10629,
340,
743,
1848,
961,
2092,
341,
197,
3244,
26133,
3964,
340,
197,
532,
1903,
11,
6607,
1669,
6505,
50,
27864,
3036,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestReconcileWithPipelineResults(t *testing.T) {
names.TestingSeed()
ps := []*v1beta1.Pipeline{{
ObjectMeta: baseObjectMeta("test-pipeline", "foo"),
Spec: v1beta1.PipelineSpec{
Tasks: []v1beta1.PipelineTask{
{
Name: "a-task",
TaskRef: &v1beta1.TaskRef{
Name: "a-task",
},
},
{
Name: "b-task",
TaskRef: &v1beta1.TaskRef{
Name: "b-task",
},
Params: []v1beta1.Param{{
Name: "bParam",
Value: *v1beta1.NewArrayOrString("$(tasks.a-task.results.aResult)"),
}},
},
},
Results: []v1beta1.PipelineResult{{
Name: "result",
Value: "$(tasks.a-task.results.aResult)",
Description: "pipeline result",
}},
},
}}
trs := []*v1beta1.TaskRun{{
ObjectMeta: taskRunObjectMeta("test-pipeline-run-different-service-accs-a-task-9l9zj", "foo",
"test-pipeline-run-different-service-accs", "test-pipeline", "a-task",
true),
Spec: v1beta1.TaskRunSpec{
TaskRef: &v1beta1.TaskRef{Name: "hello-world"},
ServiceAccountName: "test-sa",
Resources: &v1beta1.TaskRunResources{},
Timeout: &metav1.Duration{Duration: config.DefaultTimeoutMinutes * time.Minute},
},
Status: v1beta1.TaskRunStatus{
Status: duckv1beta1.Status{
Conditions: duckv1beta1.Conditions{
apis.Condition{
Type: apis.ConditionSucceeded,
Status: corev1.ConditionTrue,
},
},
},
TaskRunStatusFields: v1beta1.TaskRunStatusFields{
TaskRunResults: []v1beta1.TaskRunResult{{
Name: "aResult",
Value: "aResultValue",
}},
},
},
}}
prs := []*v1beta1.PipelineRun{{
ObjectMeta: baseObjectMeta("test-pipeline-run-different-service-accs", "foo"),
Spec: v1beta1.PipelineRunSpec{
PipelineRef: &v1beta1.PipelineRef{Name: "test-pipeline"},
ServiceAccountName: "test-sa-0",
},
Status: v1beta1.PipelineRunStatus{
Status: duckv1beta1.Status{
Conditions: duckv1beta1.Conditions{
apis.Condition{
Type: apis.ConditionSucceeded,
Status: corev1.ConditionTrue,
Reason: v1beta1.PipelineRunReasonSuccessful.String(),
Message: "All Tasks have completed executing",
},
},
},
PipelineRunStatusFields: v1beta1.PipelineRunStatusFields{
PipelineResults: []v1beta1.PipelineRunResult{{
Name: "result",
Value: "aResultValue",
}},
TaskRuns: map[string]*v1beta1.PipelineRunTaskRunStatus{
trs[0].Name: {
PipelineTaskName: "a-task",
Status: &trs[0].Status,
},
},
StartTime: &metav1.Time{Time: time.Now().AddDate(0, 0, -1)},
CompletionTime: &metav1.Time{Time: time.Now()},
},
},
}}
ts := []*v1beta1.Task{
{ObjectMeta: baseObjectMeta("a-task", "foo")},
{
ObjectMeta: baseObjectMeta("b-task", "foo"),
Spec: v1beta1.TaskSpec{
Params: []v1beta1.ParamSpec{{
Name: "bParam",
Type: v1beta1.ParamTypeString,
}},
},
},
}
d := test.Data{
PipelineRuns: prs,
Pipelines: ps,
Tasks: ts,
TaskRuns: trs,
}
prt := newPipelineRunTest(d, t)
defer prt.Cancel()
reconciledRun, _ := prt.reconcileRun("foo", "test-pipeline-run-different-service-accs", []string{}, false)
if d := cmp.Diff(&reconciledRun, &prs[0], ignoreResourceVersion); d != "" {
t.Errorf("expected to see pipeline run results created. Diff %s", diff.PrintWantGot(d))
}
} | explode_data.jsonl/68296 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 1655
} | [
2830,
3393,
693,
40446,
457,
2354,
34656,
9801,
1155,
353,
8840,
836,
8,
341,
93940,
8787,
287,
41471,
741,
35009,
1669,
29838,
85,
16,
19127,
16,
1069,
8790,
90,
515,
197,
23816,
12175,
25,
2331,
1190,
12175,
445,
1944,
2268,
8790,
4... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
func TestQueryCategoriesAPI(t *testing.T) {
want := "Greater than 0"
got := QueryCategoriesAPI("")
if len(got.Categories) <= 0 {
t.Errorf("Query Categories failed: %v \nwant: %v", got, want)
}
} | explode_data.jsonl/69059 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 77
} | [
2830,
3393,
2859,
20970,
7082,
1155,
353,
8840,
836,
8,
1476,
50780,
1669,
330,
41366,
1091,
220,
15,
698,
3174,
354,
1669,
11361,
20970,
7082,
445,
5130,
743,
2422,
3268,
354,
88159,
8,
2651,
220,
15,
341,
197,
3244,
13080,
445,
2859... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestGetChaincodes(t *testing.T) {
cryptoProvider, err := sw.NewDefaultSecurityLevelWithKeystore(sw.NewDummyKeyStore())
require.NoError(t, err)
scc := &SCC{
BuiltinSCCs: map[string]struct{}{"lscc": {}},
Support: &MockSupport{},
ACLProvider: mockAclProvider,
GetMSPIDs: getMSPIDs,
BCCSP: cryptoProvider,
BuildRegistry: &container.BuildRegistry{},
ChaincodeBuilder: &mock.ChaincodeBuilder{},
}
stub := shimtest.NewMockStub("lscc", scc)
stub.ChannelID = "test"
res := stub.MockInit("1", nil)
require.Equal(t, int32(shim.OK), res.Status, res.Message)
for _, function := range []string{"getchaincodes", "GetChaincodes"} {
t.Run(function, func(t *testing.T) {
res = stub.MockInvokeWithSignedProposal("1", [][]byte{[]byte(function), []byte("barf")}, nil)
require.NotEqual(t, int32(shim.OK), res.Status)
require.Equal(t, "invalid number of arguments to lscc: 2", res.Message)
sProp, _ := protoutil.MockSignedEndorserProposalOrPanic("test", &pb.ChaincodeSpec{}, []byte("Bob"), []byte("msg1"))
sProp.Signature = sProp.ProposalBytes
mockAclProvider.Reset()
mockAclProvider.On("CheckACL", resources.Lscc_GetInstantiatedChaincodes, "test", sProp).Return(errors.New("coyote"))
res = stub.MockInvokeWithSignedProposal("1", [][]byte{[]byte(function)}, sProp)
require.NotEqual(t, int32(shim.OK), res.Status)
require.Regexp(t, `access denied for \[`+function+`\]\[test\](.*)coyote`, res.Message)
mockAclProvider.Reset()
mockAclProvider.On("CheckACL", resources.Lscc_GetInstantiatedChaincodes, "test", sProp).Return(nil)
res = stub.MockInvokeWithSignedProposal("1", [][]byte{[]byte(function)}, sProp)
require.Equal(t, int32(shim.OK), res.Status, res.Message)
})
}
} | explode_data.jsonl/11793 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 740
} | [
2830,
3393,
1949,
18837,
25814,
1155,
353,
8840,
836,
8,
341,
1444,
9444,
5179,
11,
1848,
1669,
2021,
7121,
3675,
15352,
4449,
2354,
6608,
63373,
58902,
7121,
43344,
1592,
6093,
2398,
17957,
35699,
1155,
11,
1848,
340,
1903,
638,
1669,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func Test_Enrich_Operations(t *testing.T) {
data := `
http:
test:
some_url:
endpoint: GET /some/url
response:
ok: empty
`
old, err := unmarshalSpec([]byte(data))
assert.Equal(t, err, nil)
errors := enrichSpec(old)
assert.Equal(t, len(errors), 0)
version := &old.Versions[0]
apis := &version.Http
api := &apis.Apis[0]
operation := &api.Operations[0]
response := operation.Responses[0]
assert.Equal(t, apis.Version, version)
assert.Equal(t, api.Apis, apis)
assert.Equal(t, operation.Api, api)
assert.Equal(t, response.Operation, operation)
} | explode_data.jsonl/79856 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 272
} | [
2830,
3393,
62,
1702,
13851,
2232,
712,
804,
1155,
353,
8840,
836,
8,
341,
8924,
1669,
22074,
1254,
510,
262,
1273,
510,
286,
1045,
2903,
510,
310,
14887,
25,
7890,
608,
14689,
57254,
198,
310,
2033,
510,
394,
5394,
25,
4287,
198,
3... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestAdd(t *testing.T) {
efs := ipfs.NewExoFS(shellURL)
is := is.New(t)
id, err := efs.Add(olegFilePath)
is.NoErr(err) // cannot add file
is.Equal(id, olegCID) // file has wrong CID
ok, err := efs.PinExists(olegCID)
is.NoErr(err) // pin check failed
is.True(ok) // file is not preserved by pin
_, err = efs.Add("nodir")
is.True(err != nil) // should not add unknown dir
} | explode_data.jsonl/49334 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 177
} | [
2830,
3393,
2212,
1155,
353,
8840,
836,
8,
341,
197,
43962,
1669,
5997,
3848,
7121,
840,
78,
8485,
93558,
3144,
340,
19907,
1669,
374,
7121,
1155,
692,
15710,
11,
1848,
1669,
384,
3848,
1904,
7,
1263,
70,
19090,
340,
19907,
16766,
774... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestCT_XmlCellPrConstructor(t *testing.T) {
v := sml.NewCT_XmlCellPr()
if v == nil {
t.Errorf("sml.NewCT_XmlCellPr must return a non-nil value")
}
if err := v.Validate(); err != nil {
t.Errorf("newly constructed sml.CT_XmlCellPr should validate: %s", err)
}
} | explode_data.jsonl/27939 | {
"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,
1162,
6859,
1014,
3599,
3533,
13288,
1155,
353,
8840,
836,
8,
341,
5195,
1669,
274,
1014,
7121,
1162,
6859,
1014,
3599,
3533,
741,
743,
348,
621,
2092,
341,
197,
3244,
13080,
445,
82,
1014,
7121,
1162,
6859,
1014,
3599,
35... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
func TestRDSIngressClassAnnotation(t *testing.T) {
rh, cc, done := setup(t, func(reh *contour.EventHandler) {
reh.Builder.Source.IngressClass = "linkerd"
})
defer done()
rh.OnAdd(&v1.Service{
ObjectMeta: metav1.ObjectMeta{
Name: "kuard",
Namespace: "default",
},
Spec: v1.ServiceSpec{
Ports: []v1.ServicePort{{
Protocol: "TCP",
Port: 8080,
TargetPort: intstr.FromInt(8080),
}},
},
})
i1 := &v1beta1.Ingress{
ObjectMeta: metav1.ObjectMeta{
Name: "kuard-ing",
Namespace: "default",
Annotations: map[string]string{
"contour.heptio.com/ingress.class": "linkerd",
},
},
Spec: v1beta1.IngressSpec{
Backend: &v1beta1.IngressBackend{
ServiceName: "kuard",
ServicePort: intstr.FromInt(8080),
},
},
}
rh.OnAdd(i1)
assertRDS(t, cc, "1", virtualhosts(
envoy.VirtualHost("*",
&envoy_api_v2_route.Route{
Match: routePrefix("/"),
Action: routecluster("default/kuard/8080/da39a3ee5e"),
},
),
), nil)
i2 := &v1beta1.Ingress{
ObjectMeta: metav1.ObjectMeta{
Name: "kuard-ing",
Namespace: "default",
Annotations: map[string]string{
"kubernetes.io/ingress.class": "contour",
},
},
Spec: v1beta1.IngressSpec{
Backend: &v1beta1.IngressBackend{
ServiceName: "kuard",
ServicePort: intstr.FromInt(8080),
},
},
}
rh.OnUpdate(i1, i2)
assertRDS(t, cc, "2", nil, nil)
i3 := &v1beta1.Ingress{
ObjectMeta: metav1.ObjectMeta{
Name: "kuard-ing",
Namespace: "default",
Annotations: map[string]string{
"contour.heptio.com/ingress.class": "contour",
},
},
Spec: v1beta1.IngressSpec{
Backend: &v1beta1.IngressBackend{
ServiceName: "kuard",
ServicePort: intstr.FromInt(8080),
},
},
}
rh.OnUpdate(i2, i3)
assertRDS(t, cc, "2", nil, nil)
i4 := &v1beta1.Ingress{
ObjectMeta: metav1.ObjectMeta{
Name: "kuard-ing",
Namespace: "default",
Annotations: map[string]string{
"kubernetes.io/ingress.class": "linkerd",
},
},
Spec: v1beta1.IngressSpec{
Backend: &v1beta1.IngressBackend{
ServiceName: "kuard",
ServicePort: intstr.FromInt(8080),
},
},
}
rh.OnUpdate(i3, i4)
assertRDS(t, cc, "3", virtualhosts(
envoy.VirtualHost("*",
&envoy_api_v2_route.Route{
Match: routePrefix("/"),
Action: routecluster("default/kuard/8080/da39a3ee5e"),
},
),
), nil)
i5 := &v1beta1.Ingress{
ObjectMeta: metav1.ObjectMeta{
Name: "kuard-ing",
Namespace: "default",
Annotations: map[string]string{
"contour.heptio.com/ingress.class": "linkerd",
},
},
Spec: v1beta1.IngressSpec{
Backend: &v1beta1.IngressBackend{
ServiceName: "kuard",
ServicePort: intstr.FromInt(8080),
},
},
}
rh.OnUpdate(i4, i5)
assertRDS(t, cc, "4", virtualhosts(
envoy.VirtualHost("*",
&envoy_api_v2_route.Route{
Match: routePrefix("/"),
Action: routecluster("default/kuard/8080/da39a3ee5e"),
},
),
), nil)
rh.OnUpdate(i5, i3)
assertRDS(t, cc, "5", nil, nil)
} | explode_data.jsonl/70758 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 1496
} | [
2830,
3393,
49,
5936,
641,
2483,
1957,
19711,
1155,
353,
8840,
836,
8,
341,
7000,
71,
11,
12527,
11,
2814,
1669,
6505,
1155,
11,
2915,
5801,
71,
353,
772,
413,
10537,
8,
341,
197,
197,
11063,
15641,
30350,
5337,
2483,
1957,
284,
330... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestValidateDockerConfigSecret(t *testing.T) {
validDockerSecret := func() api.Secret {
return api.Secret{
ObjectMeta: api.ObjectMeta{Name: "foo", Namespace: "bar"},
Type: api.SecretTypeDockercfg,
Data: map[string][]byte{
api.DockerConfigKey: []byte(`{"https://index.docker.io/v1/": {"auth": "Y2x1ZWRyb29sZXIwMDAxOnBhc3N3b3Jk","email": "fake@example.com"}}`),
},
}
}
var (
missingDockerConfigKey = validDockerSecret()
emptyDockerConfigKey = validDockerSecret()
invalidDockerConfigKey = validDockerSecret()
)
delete(missingDockerConfigKey.Data, api.DockerConfigKey)
emptyDockerConfigKey.Data[api.DockerConfigKey] = []byte("")
invalidDockerConfigKey.Data[api.DockerConfigKey] = []byte("bad")
tests := map[string]struct {
secret api.Secret
valid bool
}{
"valid": {validDockerSecret(), true},
"missing dockercfg": {missingDockerConfigKey, false},
"empty dockercfg": {emptyDockerConfigKey, false},
"invalid dockercfg": {invalidDockerConfigKey, false},
}
for name, tc := range tests {
errs := ValidateSecret(&tc.secret)
if tc.valid && len(errs) > 0 {
t.Errorf("%v: Unexpected error: %v", name, errs)
}
if !tc.valid && len(errs) == 0 {
t.Errorf("%v: Unexpected non-error", name)
}
}
} | explode_data.jsonl/62815 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 523
} | [
2830,
3393,
17926,
35,
13659,
2648,
19773,
1155,
353,
8840,
836,
8,
341,
56322,
35,
13659,
19773,
1669,
2915,
368,
6330,
74779,
341,
197,
853,
6330,
74779,
515,
298,
23816,
12175,
25,
6330,
80222,
63121,
25,
330,
7975,
497,
41962,
25,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestControllerIgnoresKubeNamespaces(t *testing.T) {
controller, r := newTestController("", "")
for _, namespace := range []string{"kube-system", "kube-public"} {
request := &admv1.AdmissionRequest{
UID: "uid",
Kind: metav1.GroupVersionKind{
Version: "v1",
Kind: "Pod",
},
Namespace: namespace,
Name: "PODNAME",
Operation: "CREATE",
Object: runtime.RawExtension{
Raw: []byte(fakePodWithLabel),
},
}
requireReviewAdmissionSuccess(t, controller, admv1.AdmissionReview{
Request: request,
})
require.Empty(t, r.GetEntries(), 0)
}
} | explode_data.jsonl/32148 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 246
} | [
2830,
3393,
2051,
40,
70,
2152,
416,
42,
3760,
7980,
27338,
1155,
353,
8840,
836,
8,
341,
61615,
11,
435,
1669,
501,
2271,
2051,
19814,
85617,
2023,
8358,
4473,
1669,
2088,
3056,
917,
4913,
97717,
36648,
497,
330,
97717,
56471,
9207,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestKVStoreClient(t *testing.T) {
testCases := []struct {
config loadtest.Config
clientCount int
}{
{loadtest.Config{Size: 32, Count: 1000}, 5},
{loadtest.Config{Size: 64, Count: 1000}, 5},
{loadtest.Config{Size: 128, Count: 1000}, 5},
{loadtest.Config{Size: 256, Count: 1000}, 5},
{loadtest.Config{Size: 10240, Count: 1000}, 5},
}
factory := loadtest.NewKVStoreClientFactory()
for i, tc := range testCases {
err := factory.ValidateConfig(tc.config)
if err != nil {
t.Errorf("Expected config from test case %d to validate, but failed: %v", i, err)
}
for c := 0; c < tc.clientCount; c++ {
client, err := factory.NewClient(tc.config)
if err != nil {
t.Errorf("Did not expect error in test case %d from factory.NewClient: %v", i, err)
}
tx, err := client.GenerateTx()
if err != nil {
t.Errorf("Did not expect error in test case %d from client %d's GenerateTx: %v", i, c, err)
}
if len(tx) != tc.config.Size {
t.Errorf("Expected transaction from client %d in test case %d to be %d bytes, but was %d bytes", c, i, tc.config.Size, len(tx))
}
}
}
} | explode_data.jsonl/31450 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 452
} | [
2830,
3393,
82707,
6093,
2959,
1155,
353,
8840,
836,
8,
341,
18185,
37302,
1669,
3056,
1235,
341,
197,
25873,
414,
2795,
1944,
10753,
198,
197,
25291,
2507,
526,
198,
197,
59403,
197,
197,
90,
1078,
1944,
10753,
90,
1695,
25,
220,
18,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestActionResubmitPort(t *testing.T) {
var tests = []struct {
desc string
port int
action string
err error
}{
{
desc: "invalid port",
port: -1,
err: errResubmitPortInvalid,
},
{
desc: "port zero",
port: 0,
action: "resubmit:0",
},
{
desc: "port 1",
port: 1,
action: "resubmit:1",
},
{
desc: "max port (0xfffeff)",
port: 0xfffeff,
action: "resubmit:16776959",
},
{
desc: "max port+1 (0xfffeff)",
port: 0xffffff00,
err: errResubmitPortInvalid,
},
}
for _, tt := range tests {
t.Run(tt.desc, func(t *testing.T) {
action, err := ResubmitPort(tt.port).MarshalText()
if want, got := tt.err, err; want != got {
t.Fatalf("unexpected error:\n- want: %v\n- got: %v",
want, got)
}
if err != nil {
return
}
if want, got := tt.action, string(action); want != got {
t.Fatalf("unexpected Action:\n- want: %q\n- got: %q",
want, got)
}
})
}
} | explode_data.jsonl/49515 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 500
} | [
2830,
3393,
2512,
1061,
392,
1763,
7084,
1155,
353,
8840,
836,
8,
341,
2405,
7032,
284,
3056,
1235,
341,
197,
41653,
256,
914,
198,
197,
52257,
256,
526,
198,
197,
38933,
914,
198,
197,
9859,
262,
1465,
198,
197,
59403,
197,
197,
51... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestCreateForwarder(t *testing.T) {
entry := config.AmazonEntry{Type: "SNS",
Name: "sns-test",
Target: "arn",
}
forwarder := CreateForwarder(entry)
if forwarder.Name() != entry.Name {
t.Errorf("wrong forwarder name, expected:%s, found: %s", entry.Name, forwarder.Name())
}
} | explode_data.jsonl/81872 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 113
} | [
2830,
3393,
4021,
25925,
261,
1155,
353,
8840,
836,
8,
341,
48344,
1669,
2193,
875,
76,
5522,
5874,
90,
929,
25,
330,
50,
2448,
756,
197,
21297,
25,
256,
330,
72494,
16839,
756,
197,
197,
6397,
25,
330,
1885,
756,
197,
532,
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 TestPrivateCanal(t *testing.T) {
runTestAWS(t, "privatecanal.example.com", "privatecanal", "v1alpha1", true, 1, true, false, nil)
runTestAWS(t, "privatecanal.example.com", "privatecanal", "v1alpha2", true, 1, true, false, nil)
} | explode_data.jsonl/17497 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 93
} | [
2830,
3393,
16787,
6713,
278,
1155,
353,
8840,
836,
8,
341,
56742,
2271,
36136,
1155,
11,
330,
1996,
4814,
278,
7724,
905,
497,
330,
1996,
4814,
278,
497,
330,
85,
16,
7141,
16,
497,
830,
11,
220,
16,
11,
830,
11,
895,
11,
2092,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestSignAndValidateSecp256k1(t *testing.T) {
privKey := secp256k1.GenPrivKey()
pubKey := privKey.PubKey()
msg := crypto.CRandBytes(128)
sig, err := privKey.Sign(msg)
require.Nil(t, err)
assert.True(t, pubKey.VerifySignature(msg, sig))
// Mutate the signature, just one bit.
sig[3] ^= byte(0x01)
assert.False(t, pubKey.VerifySignature(msg, sig))
} | explode_data.jsonl/49293 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 151
} | [
2830,
3393,
7264,
3036,
17926,
8430,
79,
17,
20,
21,
74,
16,
1155,
353,
8840,
836,
8,
341,
71170,
1592,
1669,
511,
4672,
17,
20,
21,
74,
16,
65384,
32124,
1592,
741,
62529,
1592,
1669,
6095,
1592,
1069,
392,
1592,
2822,
21169,
1669,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestPullWithJSONError(t *testing.T) {
tests := map[string]struct {
imageName string
err error
expectedError string
}{
"Json error": {
"ubuntu",
&jsonmessage.JSONError{Code: 50, Message: "Json error"},
"Json error",
},
"Bad gateway": {
"ubuntu",
&jsonmessage.JSONError{Code: 502, Message: "<!doctype html>\n<html class=\"no-js\" lang=\"\">\n <head>\n </head>\n <body>\n <h1>Oops, there was an error!</h1>\n <p>We have been contacted of this error, feel free to check out <a href=\"http://status.docker.com/\">status.docker.com</a>\n to see if there is a bigger issue.</p>\n\n </body>\n</html>"},
"because the registry is temporarily unavailable",
},
}
for i, test := range tests {
fakeKeyring := &credentialprovider.FakeKeyring{}
fakeClient := &FakeDockerClient{
Errors: map[string]error{"pull": test.err},
}
puller := &dockerPuller{
client: fakeClient,
keyring: fakeKeyring,
}
err := puller.Pull(test.imageName, []api.Secret{})
if err == nil || !strings.Contains(err.Error(), test.expectedError) {
t.Errorf("%s: expect error %s, got : %s", i, test.expectedError, err)
continue
}
}
} | explode_data.jsonl/11450 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 497
} | [
2830,
3393,
36068,
2354,
5370,
1454,
1155,
353,
8840,
836,
8,
341,
78216,
1669,
2415,
14032,
60,
1235,
341,
197,
31426,
675,
257,
914,
198,
197,
9859,
1843,
1465,
198,
197,
42400,
1454,
914,
198,
197,
59403,
197,
197,
1,
5014,
1465,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestRemoveTimeoutCommand(t *testing.T) {
tests := []struct {
args []string
fetchResponse error
updateResponse error
expectedOutput string
expectError bool
}{
{[]string{}, nil, nil, "Usage", true},
{[]string{"foo"}, errors.New("error"), nil, "", true},
{[]string{"bar"}, nil, errors.New("error"), "", true},
{[]string{"check1"}, nil, nil, "OK", false},
}
for i, test := range tests {
name := ""
if len(test.args) > 0 {
name = test.args[0]
}
t.Run(fmt.Sprintf("test %d", i), func(t *testing.T) {
check := types.FixtureCheckConfig("check1")
cli := stest.NewMockCLI()
client := cli.Client.(*client.MockClient)
client.On("FetchCheck", name).Return(check, test.fetchResponse)
client.On("UpdateCheck", mock.Anything).Return(test.updateResponse)
cmd := RemoveTimeoutCommand(cli)
out, err := stest.RunCmd(cmd, test.args)
if test.expectError {
assert.Error(t, err)
} else {
assert.NoError(t, err)
}
assert.Regexp(t, test.expectedOutput, out)
})
}
} | explode_data.jsonl/6608 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 428
} | [
2830,
3393,
13021,
7636,
4062,
1155,
353,
8840,
836,
8,
341,
78216,
1669,
3056,
1235,
341,
197,
31215,
1843,
3056,
917,
198,
197,
1166,
2995,
2582,
220,
1465,
198,
197,
27175,
2582,
1465,
198,
197,
42400,
5097,
914,
198,
197,
24952,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestRotate(t *testing.T) {
dir, err := ioutil.TempDir("", "badger-test")
require.NoError(t, err)
defer os.RemoveAll(dir)
// Creating sample key.
key := make([]byte, 32)
_, err = rand.Read(key)
require.NoError(t, err)
fp, err := ioutil.TempFile("", "*.key")
require.NoError(t, err)
_, err = fp.Write(key)
require.NoError(t, err)
defer fp.Close()
// Opening DB with the encryption key.
opts := badger.DefaultOptions(dir)
opts.EncryptionKey = key
db, err := badger.Open(opts)
require.NoError(t, err)
// Closing the db.
require.NoError(t, db.Close())
// Opening the db again for the successful open.
db, err = badger.Open(opts)
require.NoError(t, err)
// Closing so that we can open another db
require.NoError(t, db.Close())
// Creating another sample key.
key2 := make([]byte, 32)
_, err = rand.Read(key2)
require.NoError(t, err)
fp2, err := ioutil.TempFile("", "*.key")
require.NoError(t, err)
_, err = fp2.Write(key2)
require.NoError(t, err)
defer fp2.Close()
oldKeyPath = fp2.Name()
sstDir = dir
// Check whether we able to rotate the key with some sample key. We should get mismatch
// error.
require.EqualError(t, doRotate(nil, []string{}), badger.ErrEncryptionKeyMismatch.Error())
// rotating key with proper key.
oldKeyPath = fp.Name()
newKeyPath = fp2.Name()
require.NoError(t, doRotate(nil, []string{}))
// Checking whether db opens with the new key.
opts.EncryptionKey = key2
db, err = badger.Open(opts)
require.NoError(t, err)
require.NoError(t, db.Close())
// Checking for plain text rotation.
oldKeyPath = newKeyPath
newKeyPath = ""
require.NoError(t, doRotate(nil, []string{}))
opts.EncryptionKey = []byte{}
db, err = badger.Open(opts)
require.NoError(t, err)
defer db.Close()
} | explode_data.jsonl/72343 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 691
} | [
2830,
3393,
34540,
1155,
353,
8840,
836,
8,
341,
48532,
11,
1848,
1669,
43144,
65009,
6184,
19814,
330,
13855,
1389,
16839,
1138,
17957,
35699,
1155,
11,
1848,
340,
16867,
2643,
84427,
14161,
340,
197,
322,
31306,
6077,
1376,
624,
23634,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestRecordBatchSerializer(t *testing.T) {
defer leaktest.AfterTest(t)()
t.Run("UnsupportedSchema", func(t *testing.T) {
_, err := colserde.NewRecordBatchSerializer([]*types.T{})
require.True(t, testutils.IsError(err, "zero length"), err)
})
// Serializing and Deserializing an invalid schema is undefined.
t.Run("SerializeDifferentColumnLengths", func(t *testing.T) {
s, err := colserde.NewRecordBatchSerializer([]*types.T{types.Int, types.Int})
require.NoError(t, err)
b := array.NewInt64Builder(memory.DefaultAllocator)
b.AppendValues([]int64{1, 2}, nil /* valid */)
firstCol := b.NewArray().Data()
b.AppendValues([]int64{3}, nil /* valid */)
secondCol := b.NewArray().Data()
_, _, err = s.Serialize(&bytes.Buffer{}, []*array.Data{firstCol, secondCol})
require.True(t, testutils.IsError(err, "mismatched data lengths"), err)
})
} | explode_data.jsonl/13191 | {
"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,
6471,
21074,
13909,
1155,
353,
8840,
836,
8,
341,
16867,
23352,
1944,
36892,
2271,
1155,
8,
2822,
3244,
16708,
445,
41884,
8632,
497,
2915,
1155,
353,
8840,
836,
8,
341,
197,
197,
6878,
1848,
1669,
1375,
47024,
7121,
6471,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestSegmentsForRedisEnterpriseId(t *testing.T) {
segments := RedisEnterpriseId{}.Segments()
if len(segments) == 0 {
t.Fatalf("RedisEnterpriseId has no segments")
}
uniqueNames := make(map[string]struct{}, 0)
for _, segment := range segments {
uniqueNames[segment.Name] = struct{}{}
}
if len(uniqueNames) != len(segments) {
t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments))
}
} | explode_data.jsonl/1714 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 167
} | [
2830,
3393,
64813,
2461,
48137,
85647,
764,
1155,
353,
8840,
836,
8,
341,
197,
56829,
1669,
34158,
85647,
764,
46391,
64813,
741,
743,
2422,
10478,
26139,
8,
621,
220,
15,
341,
197,
3244,
30762,
445,
48137,
85647,
764,
702,
902,
20632,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestReadField(t *testing.T) {
b := make([]byte, fieldSize)
copy(b[:], "NAME")
b[11] = 'C'
b[12] = 1
b[16] = 14
r := bytes.NewReader(b)
f := &field{}
f.read(r)
require.Equal(t, "NAME", f.name())
require.Equal(t, byte('C'), f.Type)
require.Equal(t, uint32(1), f.Offset)
require.Equal(t, byte(14), f.Len)
require.Equal(t, byte(0), f.Dec)
} | explode_data.jsonl/79445 | {
"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,
4418,
1877,
1155,
353,
8840,
836,
8,
341,
2233,
1669,
1281,
10556,
3782,
11,
2070,
1695,
340,
49124,
1883,
3447,
1125,
330,
7535,
1138,
2233,
58,
16,
16,
60,
284,
364,
34,
1248,
2233,
58,
16,
17,
60,
284,
220,
16,
198,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestRewriteWithLazyDivImage(t *testing.T) {
description := `<div data-url="https://example.org/image.jpg" alt="Image"></div><noscript><img src="https://example.org/fallback.jpg" alt="Fallback"></noscript>`
output := Rewriter("https://example.org/article", description, "add_dynamic_image")
expected := `<img src="https://example.org/image.jpg" alt="Image"/><noscript><img src="https://example.org/fallback.jpg" alt="Fallback"></noscript>`
if expected != output {
t.Errorf(`Not expected output: got "%s" instead of "%s"`, output, expected)
}
} | explode_data.jsonl/21481 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 185
} | [
2830,
3393,
58465,
1247,
2354,
39766,
12509,
1906,
1155,
353,
8840,
836,
8,
341,
42407,
1669,
30586,
611,
821,
25443,
428,
2428,
1110,
8687,
2659,
23349,
4819,
1,
4797,
428,
1906,
2000,
611,
1784,
36391,
1228,
1784,
1892,
2286,
428,
242... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestK8SServiceAdditionalEnvVarAddsEnvVarsToPod(t *testing.T) {
t.Parallel()
deployment := renderK8SServiceDeploymentWithSetValues(
t,
map[string]string{
"additionalContainerEnv[0].name": "DD_AGENT_HOST",
"additionalContainerEnv[0].valueFrom.fieldRef.fieldPath": "status.hostIP",
"additionalContainerEnv[1].name": "DD_ENTITY_ID",
"additionalContainerEnv[1].valueFrom.fieldRef.fieldPath": "metadata.uid",
},
)
// Verify that there is only one container and that the environments section is populated.
renderedPodContainers := deployment.Spec.Template.Spec.Containers
require.Equal(t, len(renderedPodContainers), 1)
appContainer := renderedPodContainers[0]
environments := appContainer.Env
assert.Equal(t, len(environments), 2)
renderedEnvVar := map[string]string{}
for _, env := range environments {
renderedEnvVar[env.Name] = env.ValueFrom.FieldRef.FieldPath
}
assert.Equal(t, renderedEnvVar["DD_AGENT_HOST"], "status.hostIP")
assert.Equal(t, renderedEnvVar["DD_ENTITY_ID"], "metadata.uid")
} | explode_data.jsonl/59754 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 419
} | [
2830,
3393,
42,
23,
1220,
1017,
29019,
14359,
3962,
72111,
14359,
28305,
1249,
23527,
1155,
353,
8840,
836,
8,
341,
3244,
41288,
7957,
2822,
197,
82213,
1669,
3141,
42,
23,
1220,
1017,
75286,
2354,
1649,
6227,
1006,
197,
3244,
345,
197,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
func TestFromAndToSlash(t *testing.T) {
for _, test := range slashtests {
if s := filepath.FromSlash(test.path); s != test.result {
t.Errorf("FromSlash(%q) = %q, want %q", test.path, s, test.result)
}
if s := filepath.ToSlash(test.result); s != test.path {
t.Errorf("ToSlash(%q) = %q, want %q", test.result, s, test.path)
}
}
} | explode_data.jsonl/1654 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 153
} | [
2830,
3393,
3830,
3036,
1249,
88004,
1155,
353,
8840,
836,
8,
341,
2023,
8358,
1273,
1669,
2088,
1739,
300,
426,
17966,
341,
197,
743,
274,
1669,
26054,
11439,
88004,
8623,
3875,
1215,
274,
961,
1273,
12071,
341,
298,
3244,
13080,
445,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 4 |
func TestMissionControlChannelUpdate(t *testing.T) {
ctx := createMcTestContext(t)
// Report a policy related failure. Because it is the first, we don't
// expect a penalty.
ctx.reportFailure(
0, lnwire.NewFeeInsufficient(0, lnwire.ChannelUpdate{}),
)
ctx.expectP(0, testAprioriHopProbability)
// Report another failure for the same channel. We expect it to be
// pruned.
ctx.reportFailure(
0, lnwire.NewFeeInsufficient(0, lnwire.ChannelUpdate{}),
)
ctx.expectP(0, 0)
} | explode_data.jsonl/25422 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 177
} | [
2830,
3393,
55951,
3273,
9629,
4289,
1155,
353,
8840,
836,
8,
341,
20985,
1669,
1855,
25286,
2271,
1972,
1155,
692,
197,
322,
8259,
264,
4842,
5435,
7901,
13,
9211,
432,
374,
279,
1156,
11,
582,
1513,
944,
198,
197,
322,
1720,
264,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestCreate_NoConsul(t *testing.T) {
cfg := &testConfigNoConsul{}
got, err := New(cfg).Create()
assert.NoError(t, err)
assert.NotNil(t, got)
ctx, cnl := context.WithCancel(context.Background())
defer cnl()
err = got.Harvest(ctx)
assert.NoError(t, err)
assert.Equal(t, "John Doe", cfg.Name.Get())
assert.Equal(t, int64(18), cfg.Age.Get())
assert.Equal(t, 99.9, cfg.Balance.Get())
assert.Equal(t, true, cfg.HasJob.Get())
assert.Equal(t, int64(8000), cfg.Position.Salary.Get())
assert.Equal(t, int64(24), cfg.Position.Place.RoomNumber.Get())
} | explode_data.jsonl/47206 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 240
} | [
2830,
3393,
4021,
36989,
15220,
360,
1155,
353,
8840,
836,
8,
341,
50286,
1669,
609,
1944,
2648,
2753,
15220,
360,
16094,
3174,
354,
11,
1848,
1669,
1532,
28272,
568,
4021,
741,
6948,
35699,
1155,
11,
1848,
340,
6948,
93882,
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 TestREKeyRange(t *testing.T) {
if testing.Short() {
t.Skip()
}
execStatements(t, []string{
"create table t1(id1 int, id2 int, val varbinary(128), primary key(id1))",
})
defer execStatements(t, []string{
"drop table t1",
})
engine.se.Reload(context.Background())
setVSchema(t, shardedVSchema)
defer env.SetVSchema("{}")
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
filter := &binlogdatapb.Filter{
Rules: []*binlogdatapb.Rule{{
Match: "/.*/",
Filter: "-80",
}},
}
ch := startStream(ctx, t, filter, "")
// 1, 2, 3 and 5 are in shard -80.
// 4 and 6 are in shard 80-.
input := []string{
"begin",
"insert into t1 values (1, 4, 'aaa')",
"insert into t1 values (4, 1, 'bbb')",
// Stay in shard.
"update t1 set id1 = 2 where id1 = 1",
// Move from -80 to 80-.
"update t1 set id1 = 6 where id1 = 2",
// Move from 80- to -80.
"update t1 set id1 = 3 where id1 = 4",
"commit",
}
execStatements(t, input)
expectLog(ctx, t, input, ch, [][]string{{
`begin`,
`type:FIELD field_event:<table_name:"t1" fields:<name:"id1" type:INT32 > fields:<name:"id2" type:INT32 > fields:<name:"val" type:VARBINARY > > `,
`type:ROW row_event:<table_name:"t1" row_changes:<after:<lengths:1 lengths:1 lengths:3 values:"14aaa" > > > `,
`type:ROW row_event:<table_name:"t1" row_changes:<before:<lengths:1 lengths:1 lengths:3 values:"14aaa" > after:<lengths:1 lengths:1 lengths:3 values:"24aaa" > > > `,
`type:ROW row_event:<table_name:"t1" row_changes:<before:<lengths:1 lengths:1 lengths:3 values:"24aaa" > > > `,
`type:ROW row_event:<table_name:"t1" row_changes:<after:<lengths:1 lengths:1 lengths:3 values:"31bbb" > > > `,
`gtid`,
`commit`,
}})
// Switch the vschema to make id2 the primary vindex.
altVSchema := `{
"sharded": true,
"vindexes": {
"hash": {
"type": "hash"
}
},
"tables": {
"t1": {
"column_vindexes": [
{
"column": "id2",
"name": "hash"
}
]
}
}
}`
setVSchema(t, altVSchema)
// Only the first insert should be sent.
input = []string{
"begin",
"insert into t1 values (4, 1, 'aaa')",
"insert into t1 values (1, 4, 'aaa')",
"commit",
}
execStatements(t, input)
expectLog(ctx, t, input, ch, [][]string{{
`begin`,
`type:ROW row_event:<table_name:"t1" row_changes:<after:<lengths:1 lengths:1 lengths:3 values:"41aaa" > > > `,
`gtid`,
`commit`,
}})
} | explode_data.jsonl/70181 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 1089
} | [
2830,
3393,
787,
1592,
6046,
1155,
353,
8840,
836,
8,
341,
743,
7497,
55958,
368,
341,
197,
3244,
57776,
741,
197,
630,
67328,
93122,
1155,
11,
3056,
917,
515,
197,
197,
1,
3182,
1965,
259,
16,
3724,
16,
526,
11,
877,
17,
526,
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... | 2 |
func TestPickSmallestPassingNumber(t *testing.T) {
priorities := []config.TidePriority{
{Labels: []string{"kind/failing-test"}},
{Labels: []string{"area/deflake"}},
{Labels: []string{"kind/bug", "priority/critical-urgent"}},
}
testCases := []struct {
name string
prs []PullRequest
expected int
}{
{
name: "no label",
prs: []PullRequest{
testPR("org", "repo", "A", 5, githubql.MergeableStateMergeable),
testPR("org", "repo", "A", 3, githubql.MergeableStateMergeable),
},
expected: 3,
},
{
name: "deflake PR",
prs: []PullRequest{
testPR("org", "repo", "A", 5, githubql.MergeableStateMergeable),
testPR("org", "repo", "A", 3, githubql.MergeableStateMergeable),
testPRWithLabels("org", "repo", "A", 7, githubql.MergeableStateMergeable, []string{"area/deflake"}),
},
expected: 7,
},
{
name: "same label",
prs: []PullRequest{
testPRWithLabels("org", "repo", "A", 7, githubql.MergeableStateMergeable, []string{"area/deflake"}),
testPRWithLabels("org", "repo", "A", 6, githubql.MergeableStateMergeable, []string{"area/deflake"}),
testPRWithLabels("org", "repo", "A", 1, githubql.MergeableStateMergeable, []string{"area/deflake"}),
},
expected: 1,
},
{
name: "missing one label",
prs: []PullRequest{
testPR("org", "repo", "A", 5, githubql.MergeableStateMergeable),
testPR("org", "repo", "A", 3, githubql.MergeableStateMergeable),
testPRWithLabels("org", "repo", "A", 6, githubql.MergeableStateMergeable, []string{"kind/bug"}),
},
expected: 3,
},
{
name: "complete",
prs: []PullRequest{
testPR("org", "repo", "A", 5, githubql.MergeableStateMergeable),
testPR("org", "repo", "A", 3, githubql.MergeableStateMergeable),
testPRWithLabels("org", "repo", "A", 6, githubql.MergeableStateMergeable, []string{"kind/bug"}),
testPRWithLabels("org", "repo", "A", 7, githubql.MergeableStateMergeable, []string{"area/deflake"}),
testPRWithLabels("org", "repo", "A", 8, githubql.MergeableStateMergeable, []string{"kind/bug"}),
testPRWithLabels("org", "repo", "A", 9, githubql.MergeableStateMergeable, []string{"kind/failing-test"}),
testPRWithLabels("org", "repo", "A", 10, githubql.MergeableStateMergeable, []string{"kind/bug", "priority/critical-urgent"}),
},
expected: 9,
},
}
alwaysTrue := func(*logrus.Entry, githubClient, PullRequest, contextChecker) bool { return true }
for _, tc := range testCases {
t.Run(tc.name, func(t *testing.T) {
_, got := pickHighestPriorityPR(nil, nil, tc.prs, nil, alwaysTrue, priorities)
if int(got.Number) != tc.expected {
t.Errorf("got %d, expected %d", int(got.Number), tc.expected)
}
})
}
} | explode_data.jsonl/42801 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 1157
} | [
2830,
3393,
36953,
10673,
19236,
12187,
287,
2833,
1155,
353,
8840,
836,
8,
341,
3223,
3254,
1361,
1669,
3056,
1676,
836,
577,
20555,
515,
197,
197,
90,
23674,
25,
3056,
917,
4913,
15314,
6663,
14277,
16839,
48085,
197,
197,
90,
23674,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestRobotSDRefresh(t *testing.T) {
suite := &robotSDTestSuite{}
suite.SetupTest(t)
cfg := DefaultSDConfig
cfg.HTTPClientConfig.BasicAuth = &config.BasicAuth{Username: robotTestUsername, Password: robotTestPassword}
cfg.robotEndpoint = suite.Mock.Endpoint()
d, err := newRobotDiscovery(&cfg, log.NewNopLogger())
require.NoError(t, err)
targetGroups, err := d.refresh(context.Background())
require.NoError(t, err)
require.Equal(t, 1, len(targetGroups))
targetGroup := targetGroups[0]
require.NotNil(t, targetGroup, "targetGroup should not be nil")
require.NotNil(t, targetGroup.Targets, "targetGroup.targets should not be nil")
require.Equal(t, 2, len(targetGroup.Targets))
for i, labelSet := range []model.LabelSet{
{
"__address__": model.LabelValue("123.123.123.123:80"),
"__meta_hetzner_role": model.LabelValue("robot"),
"__meta_hetzner_server_id": model.LabelValue("321"),
"__meta_hetzner_server_name": model.LabelValue("server1"),
"__meta_hetzner_server_status": model.LabelValue("ready"),
"__meta_hetzner_public_ipv4": model.LabelValue("123.123.123.123"),
"__meta_hetzner_public_ipv6_network": model.LabelValue("2a01:4f8:111:4221::/64"),
"__meta_hetzner_datacenter": model.LabelValue("nbg1-dc1"),
"__meta_hetzner_robot_product": model.LabelValue("DS 3000"),
"__meta_hetzner_robot_cancelled": model.LabelValue("false"),
},
{
"__address__": model.LabelValue("123.123.123.124:80"),
"__meta_hetzner_role": model.LabelValue("robot"),
"__meta_hetzner_server_id": model.LabelValue("421"),
"__meta_hetzner_server_name": model.LabelValue("server2"),
"__meta_hetzner_server_status": model.LabelValue("in process"),
"__meta_hetzner_public_ipv4": model.LabelValue("123.123.123.124"),
"__meta_hetzner_datacenter": model.LabelValue("fsn1-dc10"),
"__meta_hetzner_robot_product": model.LabelValue("X5"),
"__meta_hetzner_robot_cancelled": model.LabelValue("true"),
},
} {
t.Run(fmt.Sprintf("item %d", i), func(t *testing.T) {
require.Equal(t, labelSet, targetGroup.Targets[i])
})
}
} | explode_data.jsonl/19432 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 985
} | [
2830,
3393,
43374,
5491,
14567,
1155,
353,
8840,
836,
8,
341,
96572,
1669,
609,
18247,
5491,
2271,
28000,
16094,
96572,
39820,
2271,
1155,
340,
50286,
1669,
7899,
5491,
2648,
198,
50286,
27358,
2959,
2648,
48868,
5087,
284,
609,
1676,
488... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestNodeAffinityDaemonLaunchesPods(t *testing.T) {
for _, strategy := range updateStrategies() {
daemon := newDaemonSet("foo")
daemon.Spec.UpdateStrategy = *strategy
daemon.Spec.Template.Spec.Affinity = &v1.Affinity{
NodeAffinity: &v1.NodeAffinity{
RequiredDuringSchedulingIgnoredDuringExecution: &v1.NodeSelector{
NodeSelectorTerms: []v1.NodeSelectorTerm{
{
MatchExpressions: []v1.NodeSelectorRequirement{
{
Key: "color",
Operator: v1.NodeSelectorOpIn,
Values: []string{simpleNodeLabel["color"]},
},
},
},
},
},
},
}
manager, podControl, _, err := newTestController(daemon)
if err != nil {
t.Fatalf("rrror creating DaemonSetsController: %v", err)
}
addNodes(manager.nodeStore, 0, 4, nil)
addNodes(manager.nodeStore, 4, 3, simpleNodeLabel)
manager.dsStore.Add(daemon)
syncAndValidateDaemonSets(t, manager, daemon, podControl, 3, 0, 0)
}
} | explode_data.jsonl/50332 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 436
} | [
2830,
3393,
1955,
25841,
13489,
89177,
32067,
288,
23527,
82,
1155,
353,
8840,
836,
8,
341,
2023,
8358,
8282,
1669,
2088,
2647,
2580,
69388,
368,
341,
197,
2698,
64,
7291,
1669,
501,
89177,
1649,
445,
7975,
1138,
197,
2698,
64,
7291,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestBuildBazel(t *testing.T) {
testutil.Run(t, "", func(t *testutil.T) {
t.NewTempDir().Mkdir("bin").Chdir()
t.Override(&util.DefaultExecCommand, testutil.CmdRun("bazel build //:app.tar --color=no").AndRunOut("bazel info bazel-bin", "bin"))
testutil.CreateFakeImageTar("bazel:app", "bin/app.tar")
artifact := &latest_v1.Artifact{
Workspace: ".",
ArtifactType: latest_v1.ArtifactType{
BazelArtifact: &latest_v1.BazelArtifact{
BuildTarget: "//:app.tar",
},
},
}
builder := NewArtifactBuilder(fakeLocalDaemon(), &mockConfig{}, false)
_, err := builder.Build(context.Background(), ioutil.Discard, artifact, "img:tag")
t.CheckNoError(err)
})
} | explode_data.jsonl/122 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 283
} | [
2830,
3393,
11066,
33,
68326,
1155,
353,
8840,
836,
8,
341,
18185,
1314,
16708,
1155,
11,
7342,
2915,
1155,
353,
1944,
1314,
836,
8,
341,
197,
3244,
7121,
12151,
6184,
1005,
44,
12438,
445,
6863,
1827,
1143,
3741,
741,
197,
3244,
9000... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestNode_GetState(t *testing.T) {
n := NewNode(gen.Reference(), insolar.StaticRoleVirtual, nil, "127.0.0.1", "123")
assert.Equal(t, insolar.NodeReady, n.GetState())
n.(MutableNode).SetState(insolar.NodeUndefined)
assert.Equal(t, insolar.NodeUndefined, n.GetState())
n.(MutableNode).ChangeState()
assert.Equal(t, insolar.NodeJoining, n.GetState())
n.(MutableNode).ChangeState()
assert.Equal(t, insolar.NodeReady, n.GetState())
n.(MutableNode).ChangeState()
assert.Equal(t, insolar.NodeReady, n.GetState())
} | explode_data.jsonl/46249 | {
"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,
1955,
13614,
1397,
1155,
353,
8840,
836,
8,
341,
9038,
1669,
1532,
1955,
36884,
58416,
1507,
1640,
7417,
58826,
9030,
33026,
11,
2092,
11,
330,
16,
17,
22,
13,
15,
13,
15,
13,
16,
497,
330,
16,
17,
18,
1138,
6948,
1280... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestFetch(t *testing.T) {
service := compose.EnsureUp(t, "nginx")
f := mbtest.NewReportingMetricSetV2(t, getConfig(service.Host()))
events, errs := mbtest.ReportingFetchV2(f)
if len(errs) > 0 {
t.Fatalf("Expected 0 error, had %d. %v\n", len(errs), errs)
}
assert.NotEmpty(t, events)
t.Logf("%s/%s event: %+v", f.Module().Name(), f.Name(), events[0])
// Check number of fields.
event := events[0].MetricSetFields
assert.Equal(t, 10, len(event))
} | explode_data.jsonl/29320 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 198
} | [
2830,
3393,
20714,
1155,
353,
8840,
836,
8,
341,
52934,
1669,
30335,
22834,
19098,
2324,
1155,
11,
330,
73561,
5130,
1166,
1669,
10016,
1944,
7121,
70131,
54310,
1649,
53,
17,
1155,
11,
66763,
21656,
29840,
12145,
90873,
11,
70817,
1669,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
func TestLogout(t *testing.T) {
_, teardown := prepService(t)
defer teardown()
// login
jar, err := cookiejar.New(nil)
require.Nil(t, err)
client := &http.Client{Jar: jar, Timeout: 5 * time.Second}
resp, err := client.Get("http://127.0.0.1:8089/auth/dev/login?site=my-test-site")
require.Nil(t, err)
assert.Equal(t, 200, resp.StatusCode)
// logout
resp, err = client.Get("http://127.0.0.1:8089/auth/logout")
require.Nil(t, err)
assert.Equal(t, 200, resp.StatusCode)
defer resp.Body.Close()
resp, err = client.Get("http://127.0.0.1:8089/private")
require.Nil(t, err)
assert.Equal(t, 401, resp.StatusCode)
assert.NoError(t, resp.Body.Close())
} | explode_data.jsonl/34045 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 286
} | [
2830,
3393,
27958,
1155,
353,
8840,
836,
8,
341,
197,
6878,
49304,
1669,
21327,
1860,
1155,
340,
16867,
49304,
2822,
197,
322,
5858,
198,
12428,
277,
11,
1848,
1669,
12544,
19033,
7121,
27907,
340,
17957,
59678,
1155,
11,
1848,
340,
252... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestEncodeConcatenatedHashes(t *testing.T) {
// Input Hash slice. Data taken from Eacred's first three mainnet blocks.
hashSlice := []chainhash.Hash{
decodeHash("298e5cc3d985bfe7f81dc135f360abe089edd4396b86d2de66b0cef42b21d980"),
decodeHash("000000000000437482b6d47f82f374cde539440ddb108b0a76886f0d87d126b9"),
decodeHash("000000000000c41019872ff7db8fd2e9bfa05f42d3f8fee8e895e8c1e5b8dcba"),
}
hashLen := hex.EncodedLen(len(hashSlice[0]))
// Expected output. The string representations of the underlying byte arrays
// in the input []chainhash.Hash
blockHashes := []string{
"80d9212bf4ceb066ded2866b39d4ed89e0ab60f335c11df8e7bf85d9c35c8e29",
"b926d1870d6f88760a8b10db0d4439e5cd74f3827fd4b6827443000000000000",
"badcb8e5c1e895e8e8fef8d3425fa0bfe9d28fdbf72f871910c4000000000000",
}
concatenatedHashes := strings.Join(blockHashes, "")
// Test from 0 to N of the hashes
for j := 0; j < len(hashSlice)+1; j++ {
// Expected output string
concatRef := concatenatedHashes[:j*hashLen]
// Encode to string
concatenated := EncodeConcatenatedHashes(hashSlice[:j])
// Verify output
if concatenated != concatRef {
t.Fatalf("EncodeConcatenatedHashes failed (%v!=%v)",
concatenated, concatRef)
}
}
} | explode_data.jsonl/23715 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 548
} | [
2830,
3393,
32535,
78440,
268,
657,
6370,
288,
1155,
353,
8840,
836,
8,
341,
197,
322,
5571,
6531,
15983,
13,
2885,
4429,
504,
468,
580,
1151,
594,
1156,
2326,
1887,
4711,
10010,
624,
50333,
33236,
1669,
3056,
8819,
8296,
15103,
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... | 3 |
func TestParseGerritLabelValue(t *testing.T) {
tests := []struct {
in string
wantLabel string
wantValue int8
wantWhose string
}{
{"Run-TryBot=+1", "Run-TryBot", 1, ""},
{"-Run-TryBot", "-Run-TryBot", 0, ""},
{"-TryBot-Result Gobot Gobot <5976@62eb7196-b449-3ce5-99f1-c037f21e1705>", "-TryBot-Result", 0, "5976@62eb7196-b449-3ce5-99f1-c037f21e1705"},
{"Run-TryBot=+1 Brad Fitzpatrick <5065@62eb7196-b449-3ce5-99f1-c037f21e1705>", "Run-TryBot", 1, "5065@62eb7196-b449-3ce5-99f1-c037f21e1705"},
{"TryBot-Result=-1 Gobot Gobot <5976@62eb7196-b449-3ce5-99f1-c037f21e1705>", "TryBot-Result", -1, "5976@62eb7196-b449-3ce5-99f1-c037f21e1705"},
}
for _, tt := range tests {
label, value, whose := parseGerritLabelValue(tt.in)
if label != tt.wantLabel || value != tt.wantValue || whose != tt.wantWhose {
t.Errorf("parseGerritLabelValue(%q) = %q, %v, %q; want %q, %v, %q",
tt.in,
label, value, whose,
tt.wantLabel, tt.wantValue, tt.wantWhose)
}
}
} | explode_data.jsonl/66162 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 494
} | [
2830,
3393,
14463,
38,
615,
275,
2476,
1130,
1155,
353,
8840,
836,
8,
341,
78216,
1669,
3056,
1235,
341,
197,
17430,
286,
914,
198,
197,
50780,
2476,
914,
198,
197,
50780,
1130,
526,
23,
198,
197,
50780,
1639,
960,
914,
198,
197,
59... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestDownloadChunkErrorStatus(t *testing.T) {
numChunks := 2
cm := make([]execResponseChunk, 0)
for i := 0; i < numChunks; i++ {
cm = append(cm, execResponseChunk{URL: fmt.Sprintf(
"dummyURL%v", i+1), RowCount: rowsInChunk})
}
scd := &snowflakeChunkDownloader{
sc: &snowflakeConn{
rest: &snowflakeRestful{RequestTimeout: defaultRequestTimeout},
},
ctx: context.Background(),
ChunkMetas: cm,
TotalRowIndex: int64(-1),
Qrmk: "HOHOHO",
FuncDownload: downloadChunk,
FuncDownloadHelper: downloadChunkHelper,
FuncGet: getChunkTestErrorStatus,
}
scd.ChunksMutex = &sync.Mutex{}
scd.DoneDownloadCond = sync.NewCond(scd.ChunksMutex)
scd.Chunks = make(map[int][]chunkRowType)
scd.ChunksError = make(chan *chunkError, 1)
scd.FuncDownload(scd.ctx, scd, 1)
select {
case errc := <-scd.ChunksError:
if errc.Index != 1 {
t.Fatalf("the error should have caused with chunk idx: %v", errc.Index)
}
serr, ok := errc.Error.(*SnowflakeError)
if !ok {
t.Fatalf("should have been snowflake error. err: %v", errc.Error)
}
if serr.Number != ErrFailedToGetChunk {
t.Fatalf("message error code is not correct. msg: %v", serr.Number)
}
default:
t.Fatal("should have caused an error and queued in scd.ChunksError")
}
} | explode_data.jsonl/1798 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 584
} | [
2830,
3393,
11377,
28304,
1454,
2522,
1155,
353,
8840,
836,
8,
341,
22431,
89681,
1669,
220,
17,
198,
98316,
1669,
1281,
10556,
11748,
2582,
28304,
11,
220,
15,
340,
2023,
600,
1669,
220,
15,
26,
600,
366,
1629,
89681,
26,
600,
1027,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestProtocol_HandleTransferStake(t *testing.T) {
require := require.New(t)
ctrl := gomock.NewController(t)
defer ctrl.Finish()
tests := []struct {
// creat stake fields
caller address.Address
amount string
afterTransfer uint64
initBalance int64
// action fields
index uint64
gasPrice *big.Int
gasLimit uint64
nonce uint64
// block context
blkHeight uint64
blkTimestamp time.Time
blkGasLimit uint64
// NewTransferStake fields
to address.Address
toInitBalance uint64
init bool
// expected result
err error
status iotextypes.ReceiptStatus
}{
// fetchCaller ReceiptStatus_ErrNotEnoughBalance
{
identityset.Address(2),
"100990000000000000000",
0,
101,
0,
big.NewInt(unit.Qev),
1000000000,
1,
1,
time.Now(),
10000,
identityset.Address(1),
1,
false,
nil,
iotextypes.ReceiptStatus_ErrNotEnoughBalance,
},
// fetchBucket,bucket.Owner not equal to actionCtx.Caller
{
identityset.Address(1),
"100000000000000000000",
0,
1000,
0,
big.NewInt(unit.Qev),
10000,
1,
1,
time.Now(),
10000,
identityset.Address(2),
1,
true,
nil,
iotextypes.ReceiptStatus_ErrUnauthorizedOperator,
},
// fetchBucket,inMemCandidates.ContainsSelfStakingBucket is false
{
identityset.Address(1),
"100000000000000000000",
0,
101,
1,
big.NewInt(unit.Qev),
10000,
1,
1,
time.Now(),
10000,
identityset.Address(2),
1,
true,
nil,
iotextypes.ReceiptStatus_ErrInvalidBucketType,
},
{
identityset.Address(2),
"100000000000000000000",
0,
101,
0,
big.NewInt(unit.Qev),
10000,
1,
1,
time.Now(),
10000,
identityset.Address(1),
1,
false,
nil,
iotextypes.ReceiptStatus_Success,
},
}
for _, test := range tests {
sm, p, candi, candidate2, cc := initAll(t, ctrl)
_, createCost := initCreateStake(t, sm, candidate2.Owner, test.initBalance, big.NewInt(unit.Qev), 10000, 1, 1, time.Now(), 10000, p, candidate2, test.amount, false)
if test.init {
initCreateStake(t, sm, candi.Owner, test.initBalance, test.gasPrice, test.gasLimit, test.nonce, test.blkHeight, test.blkTimestamp, test.blkGasLimit, p, candi, test.amount, false)
} else {
require.NoError(setupAccount(sm, identityset.Address(1), 1))
}
act, err := action.NewTransferStake(test.nonce, test.to.String(), test.index, nil, test.gasLimit, test.gasPrice)
require.NoError(err)
intrinsic, err := act.IntrinsicGas()
require.NoError(err)
ctx := protocol.WithActionCtx(context.Background(), protocol.ActionCtx{
Caller: test.caller,
GasPrice: test.gasPrice,
IntrinsicGas: intrinsic,
Nonce: test.nonce,
})
ctx = protocol.WithBlockCtx(ctx, protocol.BlockCtx{
BlockHeight: 1,
BlockTimeStamp: time.Now(),
GasLimit: 10000000,
})
r, err := p.Handle(ctx, act, sm)
require.Equal(test.err, errors.Cause(err))
if r != nil {
require.Equal(uint64(test.status), r.Status)
} else {
require.Equal(test.status, iotextypes.ReceiptStatus_Failure)
}
if test.err == nil && test.status == iotextypes.ReceiptStatus_Success {
// test bucket index and bucket
bucketIndices, err := getCandBucketIndices(sm, candidate2.Owner)
require.NoError(err)
require.Equal(1, len(*bucketIndices))
bucketIndices, err = getVoterBucketIndices(sm, test.to)
require.NoError(err)
require.Equal(1, len(*bucketIndices))
indices := *bucketIndices
bucket, err := getBucket(sm, indices[0])
require.NoError(err)
require.Equal(candidate2.Owner, bucket.Candidate)
require.Equal(test.to.String(), bucket.Owner.String())
require.Equal(test.amount, bucket.StakedAmount.String())
// test candidate
candidate, err := getCandidate(sm, candi.Owner)
require.NoError(err)
require.Equal(test.afterTransfer, candidate.Votes.Uint64())
csm, err := NewCandidateStateManager(sm, cc)
require.NoError(err)
candidate = csm.GetByOwner(candi.Owner)
require.NotNil(candidate)
require.LessOrEqual(test.afterTransfer, candidate.Votes.Uint64())
require.Equal(candi.Name, candidate.Name)
require.Equal(candi.Operator, candidate.Operator)
require.Equal(candi.Reward, candidate.Reward)
require.Equal(candi.Owner, candidate.Owner)
require.Equal(test.afterTransfer, candidate.Votes.Uint64())
require.LessOrEqual(test.afterTransfer, candidate.SelfStake.Uint64())
// test staker's account
caller, err := accountutil.LoadAccount(sm, hash.BytesToHash160(test.caller.Bytes()))
require.NoError(err)
actCost, err := act.Cost()
require.NoError(err)
require.Equal(test.nonce, caller.Nonce)
total := big.NewInt(0)
require.Equal(unit.ConvertIotxToRau(test.initBalance), total.Add(total, caller.Balance).Add(total, actCost).Add(total, createCost))
}
}
} | explode_data.jsonl/64535 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 2121
} | [
2830,
3393,
20689,
42714,
21970,
623,
726,
1155,
353,
8840,
836,
8,
341,
17957,
1669,
1373,
7121,
1155,
340,
84381,
1669,
342,
316,
1176,
7121,
2051,
1155,
340,
16867,
23743,
991,
18176,
2822,
78216,
1669,
3056,
1235,
341,
197,
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... | 6 |
func TestReadTerragruntConfigWithDefault(t *testing.T) {
t.Parallel()
cleanupTerraformFolder(t, TEST_FIXTURE_READ_CONFIG)
rootPath := util.JoinPath(TEST_FIXTURE_READ_CONFIG, "with_default")
runTerragrunt(t, fmt.Sprintf("terragrunt apply -auto-approve --terragrunt-non-interactive --terragrunt-working-dir %s", rootPath))
// check the outputs to make sure they are as expected
stdout := bytes.Buffer{}
stderr := bytes.Buffer{}
require.NoError(
t,
runTerragruntCommand(t, fmt.Sprintf("terragrunt output -no-color -json --terragrunt-non-interactive --terragrunt-working-dir %s", rootPath), &stdout, &stderr),
)
outputs := map[string]TerraformOutput{}
require.NoError(t, json.Unmarshal([]byte(stdout.String()), &outputs))
assert.Equal(t, outputs["data"].Value, "default value")
} | explode_data.jsonl/10154 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 304
} | [
2830,
3393,
4418,
51402,
68305,
3850,
2648,
2354,
3675,
1155,
353,
8840,
836,
8,
341,
3244,
41288,
7957,
2822,
1444,
60639,
51,
13886,
627,
13682,
1155,
11,
13602,
42635,
41486,
13117,
12568,
340,
33698,
1820,
1669,
4094,
22363,
1820,
503... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.