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 TestNamespaceCloseWillCloseShard(t *testing.T) {
ctrl := xtest.NewController(t)
defer ctrl.Finish()
ctx := context.NewBackground()
defer ctx.Close()
// mock namespace + 1 shard
ns, closer := newTestNamespace(t)
defer closer()
// specify a mock shard to test being closed
shard := NewMockdatabaseShard(ctrl)
shard.EXPECT().Close().Return(nil)
ns.Lock()
ns.shards[testShardIDs[0].ID()] = shard
ns.Unlock()
// Close the namespace
require.NoError(t, ns.Close())
// Check the namespace no long owns any shards
require.Empty(t, ns.OwnedShards())
} | explode_data.jsonl/35373 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 205
} | [
2830,
3393,
22699,
7925,
9945,
7925,
2016,
567,
1155,
353,
8840,
836,
8,
341,
84381,
1669,
856,
1944,
7121,
2051,
1155,
340,
16867,
23743,
991,
18176,
2822,
20985,
1669,
2266,
7121,
8706,
741,
16867,
5635,
10421,
2822,
197,
322,
7860,
4... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestFSCacheList(t *testing.T) {
cleanupFSDatastore(t)
defer cleanupFSDatastore(t)
// Increase cacheTTL so eviction does not happen while we test content of list
cacheTTL = int64(10 * time.Second)
defer func() {
cacheTTL = int64(testFSDefaultCacheTTL)
}()
fs := createDefaultFileStore(t)
defer fs.Close()
msg := []byte("hello")
cs := storeCreateChannel(t, fs, "foo")
// Store messages 1, 2, 3
for i := 0; i < 3; i++ {
storeMsg(t, cs, "foo", uint64(i+1), msg)
}
ms := cs.Msgs.(*FileMsgStore)
// Check list content
checkList := func(expectedSeqs ...uint64) {
ms.RLock()
c := ms.cache
cMsg := c.head
i := 0
good := 0
gotStr := ""
for cMsg != nil {
gotStr = fmt.Sprintf("%v%v ", gotStr, cMsg.msg.Sequence)
if cMsg.msg.Sequence == expectedSeqs[i] {
good++
}
i++
cMsg = cMsg.next
}
ms.RUnlock()
if i != len(expectedSeqs) || good != len(expectedSeqs) {
expectedStr := ""
for i := 0; i < len(expectedSeqs); i++ {
expectedStr = fmt.Sprintf("%v%v ", expectedStr, expectedSeqs[i])
}
stackFatalf(t, "Expected sequences: %q, got %q", expectedStr, gotStr)
}
}
// Check that we should have 1, 2, 3
checkList(1, 2, 3)
// Lookup first, should be moved to end of list
ms.Lookup(1)
checkList(2, 3, 1)
// Repeat...
ms.lookup(2)
checkList(3, 1, 2)
ms.Lookup(3)
checkList(1, 2, 3)
// Lookup last should leave it there
ms.Lookup(3)
checkList(1, 2, 3)
} | explode_data.jsonl/7775 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 622
} | [
2830,
3393,
37,
3540,
1777,
852,
1155,
353,
8840,
836,
8,
341,
1444,
60639,
8485,
1043,
4314,
1155,
340,
16867,
21290,
8485,
1043,
4314,
1155,
692,
197,
322,
39633,
6500,
51,
13470,
773,
78236,
1558,
537,
3537,
1393,
582,
1273,
2213,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestScreenshotHighDPI(t *testing.T) {
t.Parallel()
ctx, cancel := testAllocate(t, "image.html")
defer cancel()
// Use a weird screen dimension with a 1.5 scale factor, so that
// cropping the screenshot is forced to use floating point arithmetic
// and keep the high DPI in mind.
// We also want the dimensions to be large enough to see the element we
// want, since we're not scrolling to ensure it's in view.
if err := Run(ctx, EmulateViewport(905, 705, EmulateScale(1.5))); err != nil {
t.Fatal(err)
}
var buf []byte
if err := Run(ctx, Screenshot("#half-color", &buf, ByID)); err != nil {
t.Fatal(err)
}
img, err := png.Decode(bytes.NewReader(buf))
if err != nil {
t.Fatal(err)
}
size := img.Bounds().Size()
wantSize := 300 // 200px at 1.5 scaling factor
if size.X != wantSize || size.Y != wantSize {
t.Fatalf("expected dimensions to be %d*%d, got %d*%d",
wantSize, wantSize, size.X, size.Y)
}
wantColor := func(x, y int, r, g, b, a uint32) {
color := img.At(x, y)
r_, g_, b_, a_ := color.RGBA()
if r_ != r || g_ != g || b_ != b || a_ != a {
t.Errorf("got 0x%04x%04x%04x%04x at (%d,%d), want 0x%04x%04x%04x%04x",
r_, g_, b_, a_, x, y, r, g, b, a)
}
}
// The left half is blue.
wantColor(5, 5, 0x0, 0x0, 0xffff, 0xffff)
wantColor(5, 295, 0x0, 0x0, 0xffff, 0xffff)
// The right half is red.
wantColor(295, 5, 0xffff, 0x0, 0x0, 0xffff)
wantColor(295, 295, 0xffff, 0x0, 0x0, 0xffff)
} | explode_data.jsonl/59485 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 624
} | [
2830,
3393,
62522,
11976,
35,
1893,
1155,
353,
8840,
836,
8,
341,
3244,
41288,
7957,
2822,
20985,
11,
9121,
1669,
1273,
75380,
1155,
11,
330,
1805,
2564,
1138,
16867,
9121,
2822,
197,
322,
5443,
264,
16283,
4171,
12871,
448,
264,
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... | 5 |
func TestGetAll(t *testing.T) {
feed := New()
feed.Add(Item{})
results := feed.GetAll()
if len(results) != 1 {
t.Errorf("Item was not added")
}
} | explode_data.jsonl/68316 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 64
} | [
2830,
3393,
1949,
2403,
1155,
353,
8840,
836,
8,
341,
1166,
12051,
1669,
1532,
741,
1166,
12051,
1904,
29771,
37790,
55497,
1669,
5395,
45732,
741,
743,
2422,
20484,
8,
961,
220,
16,
341,
197,
3244,
13080,
445,
1234,
572,
537,
3694,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestMultipleRulesSingleNsWithDataChange(t *testing.T) {
gomega.RegisterTestingT(t)
logger := logrus.DefaultLogger()
logger.SetLevel(logging.DebugLevel)
logger.Debug("TestMultipleRulesSingleNsWithDataChange")
// Prepare input data.
const (
nsIndex = 10
podIP = "192.168.2.1"
)
inRule1 := newContivRule("allow-http", renderer.ActionPermit, &net.IPNet{}, ipNetwork("192.168.1.0/24"), renderer.TCP, 80)
inRule2 := newContivRule("allow-ssh", renderer.ActionPermit, &net.IPNet{}, ipNetwork("192.168.2.0/24"), renderer.TCP, 22)
egRule1 := newContivRule("allow-UDP:777", renderer.ActionPermit, ipNetwork("192.168.3.1/32"), &net.IPNet{}, renderer.UDP, 777)
egRule2 := newContivRule("deny-all-TCP", renderer.ActionDeny, &net.IPNet{}, &net.IPNet{}, renderer.TCP, 0)
egRule3 := newContivRule("deny-all-UDP", renderer.ActionDeny, &net.IPNet{}, &net.IPNet{}, renderer.UDP, 0)
ingress := []*renderer.ContivRule{inRule1, inRule2}
egress := []*renderer.ContivRule{egRule1, egRule2, egRule3}
// Create an instance of SessionRuleCache
ruleCache := &SessionRuleCache{
Deps: Deps{
Log: logger,
},
}
ruleCache.Init(func() ([]*SessionRule, error) { return []*SessionRule{}, nil }, tagPrefix)
checkNamespaces(ruleCache)
// Run single transaction.
txn := ruleCache.NewTxn(false)
added, removed, err := txn.Changes()
gomega.Expect(err).To(gomega.BeNil())
gomega.Expect(added).To(gomega.BeEmpty())
gomega.Expect(removed).To(gomega.BeEmpty())
// Change config for one namespace
txn.Update(nsIndex, GetOneHostSubnet(podIP), ingress, egress)
checkNamespaces(ruleCache) // not yet commited
added, removed, err = txn.Changes()
gomega.Expect(err).To(gomega.BeNil())
gomega.Expect(len(added)).To(gomega.BeEquivalentTo(7))
gomega.Expect(len(removed)).To(gomega.BeEquivalentTo(0))
checkSessionRule(added, "LOCAL", nsIndex, "", 0, "192.168.1.0/24", 80, "TCP", "ALLOW")
checkSessionRule(added, "LOCAL", nsIndex, "", 0, "192.168.2.0/24", 22, "TCP", "ALLOW")
checkSessionRule(added, "GLOBAL", 0, podIP, 777, "192.168.3.1/32", 0, "UDP", "ALLOW")
checkSessionRule(added, "GLOBAL", 0, podIP, 0, "0.0.0.0/1", 0, "TCP", "DENY")
checkSessionRule(added, "GLOBAL", 0, podIP, 0, "128.0.0.0/1", 0, "TCP", "DENY")
checkSessionRule(added, "GLOBAL", 0, podIP, 0, "0.0.0.0/1", 0, "UDP", "DENY")
checkSessionRule(added, "GLOBAL", 0, podIP, 0, "128.0.0.0/1", 0, "UDP", "DENY")
// Commit the transaction.
txn.Commit()
checkNamespaces(ruleCache, 10)
// Verify cache content.
cacheIngress, cacheEgress := ruleCache.LookupByNamespace(10)
checkContivRules(cacheIngress, ingress)
checkContivRules(cacheEgress, egress)
// Run second transaction with a config change.
txn = ruleCache.NewTxn(false)
added, removed, err = txn.Changes()
gomega.Expect(err).To(gomega.BeNil())
gomega.Expect(added).To(gomega.BeEmpty())
gomega.Expect(removed).To(gomega.BeEmpty())
// Updated config.
inRule3 := newContivRule("deny-all-TCP", renderer.ActionDeny, &net.IPNet{}, &net.IPNet{}, renderer.TCP, 0)
egRule4 := newContivRule("allow-all-TCP", renderer.ActionPermit, &net.IPNet{}, &net.IPNet{}, renderer.TCP, 0)
ingress2 := []*renderer.ContivRule{inRule3}
egress2 := []*renderer.ContivRule{egRule1, egRule3, egRule4}
// Change config for one namespace
txn.Update(nsIndex, GetOneHostSubnet(podIP), ingress2, egress2)
added, removed, err = txn.Changes()
gomega.Expect(err).To(gomega.BeNil())
gomega.Expect(len(added)).To(gomega.BeEquivalentTo(4))
gomega.Expect(len(removed)).To(gomega.BeEquivalentTo(4))
checkSessionRule(added, "LOCAL", nsIndex, "", 0, "0.0.0.0/1", 0, "TCP", "DENY")
checkSessionRule(added, "LOCAL", nsIndex, "", 0, "128.0.0.0/1", 0, "TCP", "DENY")
checkSessionRule(added, "LOCAL", nsIndex, "", 0, "0000:0000:0000:0000:0000:0000:0000:0000/1", 0, "TCP", "DENY")
checkSessionRule(added, "LOCAL", nsIndex, "", 0, "8000:0000:0000:0000:0000:0000:0000:0000/1", 0, "TCP", "DENY")
/* allow all-TCP needs no extra rule */
checkSessionRule(removed, "LOCAL", nsIndex, "", 0, "192.168.1.0/24", 80, "TCP", "ALLOW")
checkSessionRule(removed, "LOCAL", nsIndex, "", 0, "192.168.2.0/24", 22, "TCP", "ALLOW")
checkSessionRule(removed, "GLOBAL", 0, podIP, 0, "0.0.0.0/1", 0, "TCP", "DENY")
checkSessionRule(removed, "GLOBAL", 0, podIP, 0, "128.0.0.0/1", 0, "TCP", "DENY")
// Commit the transaction.
txn.Commit()
checkNamespaces(ruleCache, 10)
// Verify cache content.
cacheIngress, cacheEgress = ruleCache.LookupByNamespace(10)
checkContivRules(cacheIngress, ingress2)
checkContivRules(cacheEgress, egress2)
} | explode_data.jsonl/74320 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 1897
} | [
2830,
3393,
32089,
26008,
10888,
45,
16056,
1043,
4072,
1155,
353,
8840,
836,
8,
341,
3174,
32696,
19983,
16451,
51,
1155,
340,
17060,
1669,
1487,
20341,
13275,
7395,
741,
17060,
4202,
4449,
51687,
20345,
4449,
340,
17060,
20345,
445,
227... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestMinInt64Init1(t *testing.T) {
h := new(MinInt64)
for i := 20; i > 0; i-- {
h.Push(int64(i)) // all elements are different
}
h.Init()
h.verify(t, 0)
for i := 1; h.length() > 0; i++ {
x := h.Pop()
h.verify(t, 0)
if x != int64(i) {
t.Errorf("%d.th pop got %d; want %d", i, x, int64(i))
}
}
} | explode_data.jsonl/57431 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 166
} | [
2830,
3393,
6217,
1072,
21,
19,
3803,
16,
1155,
353,
8840,
836,
8,
341,
9598,
1669,
501,
3189,
258,
1072,
21,
19,
340,
2023,
600,
1669,
220,
17,
15,
26,
600,
861,
220,
15,
26,
600,
313,
341,
197,
9598,
34981,
1548,
21,
19,
1956,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestWebRequestEventProperties(t *testing.T) {
assert := assert.New(t)
e := NewHTTPRequestEvent(nil)
assert.False(e.Timestamp().IsZero())
assert.True(e.WithTimestamp(time.Time{}).Timestamp().IsZero())
assert.Empty(e.Labels())
assert.Equal("bar", e.WithLabel("foo", "bar").Labels()["foo"])
assert.Empty(e.Annotations())
assert.Equal("zar", e.WithAnnotation("moo", "zar").Annotations()["moo"])
assert.Equal(HTTPRequest, e.Flag())
assert.Equal(Error, e.WithFlag(Error).Flag())
assert.Empty(e.Headings())
assert.Equal([]string{"Heading"}, e.WithHeadings("Heading").Headings())
assert.Nil(e.Request())
assert.NotNil(e.WithRequest(&http.Request{}).Request())
assert.Nil(e.State())
assert.Equal("foo", e.WithState(map[interface{}]interface{}{"bar": "foo"}).State()["bar"])
assert.Empty(e.Route())
assert.Equal("Route", e.WithRoute("Route").Route())
} | explode_data.jsonl/8486 | {
"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,
46295,
1556,
7903,
1155,
353,
8840,
836,
8,
341,
6948,
1669,
2060,
7121,
1155,
692,
7727,
1669,
1532,
63765,
1556,
27907,
692,
6948,
50757,
2026,
49024,
1005,
3872,
17999,
2398,
6948,
32443,
2026,
26124,
20812,
9730,
16299,
62... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestSave(t *testing.T) {
repo, cleanup := repository.TestRepository(t)
defer cleanup()
for _, size := range testSizes {
data := make([]byte, size)
_, err := io.ReadFull(rnd, data)
rtest.OK(t, err)
id := restic.Hash(data)
// save
sid, _, err := repo.SaveBlob(context.TODO(), restic.DataBlob, data, restic.ID{}, false)
rtest.OK(t, err)
rtest.Equals(t, id, sid)
rtest.OK(t, repo.Flush(context.Background()))
// rtest.OK(t, repo.SaveIndex())
// read back
buf, err := repo.LoadBlob(context.TODO(), restic.DataBlob, id, nil)
rtest.OK(t, err)
rtest.Equals(t, size, len(buf))
rtest.Assert(t, len(buf) == len(data),
"number of bytes read back does not match: expected %d, got %d",
len(data), len(buf))
rtest.Assert(t, bytes.Equal(buf, data),
"data does not match: expected %02x, got %02x",
data, buf)
}
} | explode_data.jsonl/71936 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 375
} | [
2830,
3393,
8784,
1155,
353,
8840,
836,
8,
341,
17200,
5368,
11,
21290,
1669,
12542,
8787,
4624,
1155,
340,
16867,
21290,
2822,
2023,
8358,
1379,
1669,
2088,
1273,
34930,
341,
197,
8924,
1669,
1281,
10556,
3782,
11,
1379,
340,
197,
197,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
func TestNilValidator(t *testing.T) {
type TestStruct struct {
Test string `validate:"required"`
}
ts := TestStruct{}
var val *Validate
fn := func(fl FieldLevel) bool {
return fl.Parent().String() == fl.Field().String()
}
PanicMatches(t, func() { val.RegisterCustomTypeFunc(ValidateCustomType, MadeUpCustomType{}) }, "runtime error: invalid memory address or nil pointer dereference")
PanicMatches(t, func() { _ = val.RegisterValidation("something", fn) }, "runtime error: invalid memory address or nil pointer dereference")
PanicMatches(t, func() { _ = val.Var(ts.Test, "required") }, "runtime error: invalid memory address or nil pointer dereference")
PanicMatches(t, func() { _ = val.VarWithValue("test", ts.Test, "required") }, "runtime error: invalid memory address or nil pointer dereference")
PanicMatches(t, func() { _ = val.Struct(ts) }, "runtime error: invalid memory address or nil pointer dereference")
PanicMatches(t, func() { _ = val.StructExcept(ts, "Test") }, "runtime error: invalid memory address or nil pointer dereference")
PanicMatches(t, func() { _ = val.StructPartial(ts, "Test") }, "runtime error: invalid memory address or nil pointer dereference")
} | explode_data.jsonl/77223 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 361
} | [
2830,
3393,
19064,
14256,
1155,
353,
8840,
836,
8,
1476,
13158,
3393,
9422,
2036,
341,
197,
73866,
914,
1565,
7067,
2974,
6279,
8805,
197,
630,
57441,
1669,
3393,
9422,
31483,
2405,
1044,
353,
17926,
271,
40095,
1669,
2915,
49747,
8601,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestWatchFromNotFound(t *testing.T) {
fakeClient := NewFakeEtcdClient(t)
fakeClient.Data["/some/key"] = EtcdResponseWithError{
R: &etcd.Response{
Node: nil,
},
E: &etcd.EtcdError{
Index: 2,
ErrorCode: 100,
},
}
h := EtcdHelper{fakeClient, codec, versioner}
watching := h.Watch("/some/key", 0)
fakeClient.WaitForWatchCompletion()
if fakeClient.WatchIndex != 3 {
t.Errorf("Expected client to wait for %d, got %#v", 3, fakeClient)
}
watching.Stop()
} | explode_data.jsonl/40982 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 203
} | [
2830,
3393,
14247,
3830,
10372,
1155,
353,
8840,
836,
8,
341,
1166,
726,
2959,
1669,
1532,
52317,
31860,
4385,
2959,
1155,
340,
1166,
726,
2959,
3336,
1183,
14,
14689,
68864,
1341,
284,
18888,
4385,
2582,
66102,
515,
197,
11143,
25,
609... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestDefaultExporters(t *testing.T) {
factories, err := Components()
assert.NoError(t, err)
expFactories := factories.Exporters
endpoint := testutil.GetAvailableLocalAddress(t)
parquetTempDir, err := ioutil.TempDir("", "*")
assert.NoError(t, err)
defer os.RemoveAll(parquetTempDir)
tests := []struct {
exporter config.Type
getConfigFn getExporterConfigFn
skipLifecycle bool
}{
{
exporter: "file",
getConfigFn: func() config.Exporter {
cfg := expFactories["file"].CreateDefaultConfig().(*fileexporter.Config)
f, err := ioutil.TempFile("", "otelcol_defaults_file_exporter_test*.tmp")
require.NoError(t, err)
assert.NoError(t, f.Close())
cfg.Path = f.Name()
return cfg
},
},
{
exporter: "jaeger",
getConfigFn: func() config.Exporter {
cfg := expFactories["jaeger"].CreateDefaultConfig().(*jaegerexporter.Config)
cfg.Endpoint = endpoint
return cfg
},
},
{
exporter: "jaeger_thrift",
getConfigFn: func() config.Exporter {
cfg := expFactories["jaeger_thrift"].CreateDefaultConfig().(*jaegerthrifthttpexporter.Config)
cfg.Endpoint = "http://" + endpoint
return cfg
},
},
{
exporter: "kafka",
getConfigFn: func() config.Exporter {
cfg := expFactories["kafka"].CreateDefaultConfig().(*kafkaexporter.Config)
cfg.Brokers = []string{"invalid:9092"}
// this disables contacting the broker so we can successfully create the exporter
cfg.Metadata.Full = false
return cfg
},
},
{
exporter: "logging",
skipLifecycle: runtime.GOOS == "darwin", // TODO: investigate why this fails on darwin.
},
{
exporter: "opencensus",
getConfigFn: func() config.Exporter {
cfg := expFactories["opencensus"].CreateDefaultConfig().(*opencensusexporter.Config)
cfg.GRPCClientSettings = configgrpc.GRPCClientSettings{
Endpoint: endpoint,
}
return cfg
},
},
{
exporter: "otlp",
getConfigFn: func() config.Exporter {
cfg := expFactories["otlp"].CreateDefaultConfig().(*otlpexporter.Config)
cfg.GRPCClientSettings = configgrpc.GRPCClientSettings{
Endpoint: endpoint,
}
return cfg
},
},
{
exporter: "otlphttp",
getConfigFn: func() config.Exporter {
cfg := expFactories["otlphttp"].CreateDefaultConfig().(*otlphttpexporter.Config)
cfg.Endpoint = "http://" + endpoint
return cfg
},
},
{
exporter: "parquet",
getConfigFn: func() config.Exporter {
cfg := expFactories["parquet"].CreateDefaultConfig().(*parquetexporter.Config)
cfg.Path = parquetTempDir
return cfg
},
},
{
exporter: "prometheus",
getConfigFn: func() config.Exporter {
cfg := expFactories["prometheus"].CreateDefaultConfig().(*prometheusexporter.Config)
cfg.Endpoint = endpoint
return cfg
},
},
{
exporter: "prometheusremotewrite",
},
{
exporter: "sapm",
getConfigFn: func() config.Exporter {
cfg := expFactories["sapm"].CreateDefaultConfig().(*sapmexporter.Config)
cfg.Endpoint = "http://" + endpoint
return cfg
},
},
{
exporter: "signalfx",
getConfigFn: func() config.Exporter {
cfg := expFactories["signalfx"].CreateDefaultConfig().(*signalfxexporter.Config)
cfg.AccessToken = "my_fake_token"
cfg.IngestURL = "http://" + endpoint
cfg.APIURL = "http://" + endpoint
return cfg
},
},
{
exporter: "splunk_hec",
getConfigFn: func() config.Exporter {
cfg := expFactories["splunk_hec"].CreateDefaultConfig().(*splunkhecexporter.Config)
cfg.Token = "my_fake_token"
cfg.Endpoint = "http://" + endpoint
return cfg
},
},
{
exporter: "zipkin",
getConfigFn: func() config.Exporter {
cfg := expFactories["zipkin"].CreateDefaultConfig().(*zipkinexporter.Config)
cfg.Endpoint = endpoint
return cfg
},
},
}
assert.Equal(t, len(tests)+25 /* not tested */, len(expFactories))
for _, tt := range tests {
t.Run(string(tt.exporter), func(t *testing.T) {
factory, ok := expFactories[tt.exporter]
require.True(t, ok)
assert.Equal(t, tt.exporter, factory.Type())
assert.Equal(t, config.NewComponentID(tt.exporter), factory.CreateDefaultConfig().ID())
if tt.skipLifecycle {
t.Log("Skipping lifecycle test", tt.exporter)
return
}
verifyExporterLifecycle(t, factory, tt.getConfigFn)
})
}
} | explode_data.jsonl/63731 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 1849
} | [
2830,
3393,
3675,
16894,
388,
1155,
353,
8840,
836,
8,
341,
1166,
52893,
11,
1848,
1669,
34085,
741,
6948,
35699,
1155,
11,
1848,
692,
48558,
17417,
2433,
1669,
34059,
81077,
388,
198,
6246,
2768,
1669,
1273,
1314,
2234,
16485,
7319,
42... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestParts(t *testing.T) {
testData := `16,1,2,0,4,2,7,1,2,14`
util.RunTests(t, testData, []util.TestCase{
{Desc: "Part 1", PartFunc: part1, Expected: 37},
{Desc: "Part 2", PartFunc: part2, Expected: 168},
})
} | explode_data.jsonl/48384 | {
"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,
28921,
1155,
353,
8840,
836,
8,
972,
18185,
1043,
1669,
1565,
16,
21,
11,
16,
11,
17,
11,
15,
11,
19,
11,
17,
11,
22,
11,
16,
11,
17,
11,
16,
19,
63,
871,
79138,
16708,
18200,
1155,
11,
67348,
11,
3056,
1314,
31363... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestBigZero(t *testing.T) {
const size = 1 << 10
var v [size]byte
z := Zero(ValueOf(v).Type()).Interface().([size]byte)
for i := 0; i < size; i++ {
if z[i] != 0 {
t.Fatalf("Zero object not all zero, index %d", i)
}
}
} | explode_data.jsonl/29621 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 104
} | [
2830,
3393,
15636,
17999,
1155,
353,
8840,
836,
8,
341,
4777,
1379,
284,
220,
16,
1115,
220,
16,
15,
198,
2405,
348,
508,
2141,
90184,
198,
20832,
1669,
18306,
25346,
2124,
3747,
568,
929,
6011,
5051,
1005,
2561,
2141,
90184,
340,
202... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestDebugHandler(t *testing.T) {
for _, tc := range []struct {
prefix, url string
code int
}{
{"/", "/debug/pprof/cmdline", 200},
{"/foo", "/foo/debug/pprof/cmdline", 200},
{"/", "/debug/pprof/goroutine", 200},
{"/foo", "/foo/debug/pprof/goroutine", 200},
{"/", "/debug/pprof/foo", 404},
{"/foo", "/bar/debug/pprof/goroutine", 404},
} {
opts := &Options{
RoutePrefix: tc.prefix,
ListenAddress: "somehost:9090",
ExternalURL: &url.URL{
Host: "localhost.localdomain:9090",
Scheme: "http",
},
}
handler := New(nil, opts)
handler.Ready()
w := httptest.NewRecorder()
req, err := http.NewRequest("GET", tc.url, nil)
require.NoError(t, err)
handler.router.ServeHTTP(w, req)
require.Equal(t, tc.code, w.Code)
}
} | explode_data.jsonl/46073 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 357
} | [
2830,
3393,
7939,
3050,
1155,
353,
8840,
836,
8,
341,
2023,
8358,
17130,
1669,
2088,
3056,
1235,
341,
197,
3223,
5060,
11,
2515,
914,
198,
197,
43343,
286,
526,
198,
197,
59403,
197,
197,
90,
3115,
497,
3521,
8349,
87146,
299,
69,
8... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
func TestRuleForbiddenProcedure(t *testing.T) {
common.Log.Debug("Entering function: %s", common.GetFunctionName())
sqls := []string{
`CREATE PROCEDURE simpleproc (OUT param1 INT)`,
}
for _, sql := range sqls {
q, _ := NewQuery4Audit(sql)
rule := q.RuleForbiddenProcedure()
if rule.Item != "FUN.008" {
t.Error("Rule not match:", rule.Item, "Expect : FUN.008")
}
}
common.Log.Debug("Exiting function: %s", common.GetFunctionName())
} | explode_data.jsonl/76799 | {
"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,
11337,
69115,
33155,
1155,
353,
8840,
836,
8,
341,
83825,
5247,
20345,
445,
82867,
729,
25,
1018,
82,
497,
4185,
2234,
5152,
675,
2398,
30633,
82,
1669,
3056,
917,
515,
197,
197,
63,
22599,
24363,
83060,
4285,
15782,
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... | 3 |
func TestRepoAddCmd(t *testing.T) {
srv, thome, err := repotest.NewTempServer("testdata/testserver/*.*")
if err != nil {
t.Fatal(err)
}
cleanup := resetEnv()
defer func() {
srv.Stop()
os.RemoveAll(thome.String())
cleanup()
}()
if err := ensureTestHome(thome, t); err != nil {
t.Fatal(err)
}
settings.Home = thome
tests := []releaseCase{
{
name: "add a repository",
args: []string{testName, srv.URL()},
expected: "\"" + testName + "\" has been added to your repositories",
},
}
runReleaseCases(t, tests, func(c *helm.FakeClient, out io.Writer) *cobra.Command {
return newRepoAddCmd(out)
})
} | explode_data.jsonl/66303 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 273
} | [
2830,
3393,
25243,
2212,
15613,
1155,
353,
8840,
836,
8,
341,
1903,
10553,
11,
270,
635,
11,
1848,
1669,
2064,
354,
477,
7121,
12151,
5475,
445,
92425,
12697,
4030,
1057,
4908,
1138,
743,
1848,
961,
2092,
341,
197,
3244,
26133,
3964,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestMergedGroupsConfig(t *testing.T) {
var containsMergedConfig bool
found := sets.String{}
dups := sets.String{}
for _, g := range cfg.Groups {
name := g.Name
if name == "steering" {
containsMergedConfig = true
}
if found.Has(name) {
dups.Insert(name)
}
found.Insert(name)
}
if !containsMergedConfig {
t.Errorf("Final GroupsConfig does not have merged configs from all groups.yaml files")
}
if n := len(dups); n > 0 {
t.Errorf("%d duplicate groups: %s", n, strings.Join(dups.List(), ", "))
}
} | explode_data.jsonl/24787 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 215
} | [
2830,
3393,
44,
51525,
22173,
2648,
1155,
353,
8840,
836,
8,
341,
2405,
5610,
44,
51525,
2648,
1807,
198,
58102,
1669,
7289,
6431,
16094,
2698,
8602,
1669,
7289,
6431,
31483,
2023,
8358,
342,
1669,
2088,
13286,
59800,
341,
197,
11609,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 6 |
func TestReconcileControlPlaneMachineHealthCheck(t *testing.T) {
g := NewWithT(t)
// Create InfrastructureMachineTemplates for test cases
infrastructureMachineTemplate := builder.InfrastructureMachineTemplate(metav1.NamespaceDefault, "infra1").Build()
mhcClass := &clusterv1.MachineHealthCheckClass{
UnhealthyConditions: []clusterv1.UnhealthyCondition{
{
Type: corev1.NodeReady,
Status: corev1.ConditionUnknown,
Timeout: metav1.Duration{Duration: 5 * time.Minute},
},
},
}
maxUnhealthy := intstr.Parse("45%")
// Create clusterClasses requiring controlPlaneInfrastructure and one not.
ccWithControlPlaneInfrastructure := &scope.ControlPlaneBlueprint{
InfrastructureMachineTemplate: infrastructureMachineTemplate,
MachineHealthCheck: mhcClass,
}
ccWithoutControlPlaneInfrastructure := &scope.ControlPlaneBlueprint{
MachineHealthCheck: mhcClass,
}
// Create ControlPlane Object.
controlPlane1 := builder.ControlPlane(metav1.NamespaceDefault, "cp1").
WithInfrastructureMachineTemplate(infrastructureMachineTemplate).
Build()
mhcBuilder := builder.MachineHealthCheck(metav1.NamespaceDefault, "cp1").
WithSelector(*selectorForControlPlaneMHC()).
WithUnhealthyConditions(mhcClass.UnhealthyConditions).
WithClusterName("cluster1")
tests := []struct {
name string
class *scope.ControlPlaneBlueprint
current *scope.ControlPlaneState
desired *scope.ControlPlaneState
want *clusterv1.MachineHealthCheck
}{
{
name: "Should create desired ControlPlane MachineHealthCheck for a new ControlPlane",
class: ccWithControlPlaneInfrastructure,
current: nil,
desired: &scope.ControlPlaneState{
Object: controlPlane1.DeepCopy(),
InfrastructureMachineTemplate: infrastructureMachineTemplate.DeepCopy(),
MachineHealthCheck: mhcBuilder.Build()},
want: mhcBuilder.
WithOwnerReferences([]metav1.OwnerReference{*ownerReferenceTo(controlPlane1)}).
Build(),
},
{
name: "Should not create ControlPlane MachineHealthCheck when no MachineInfrastructure is defined",
class: ccWithoutControlPlaneInfrastructure,
current: &scope.ControlPlaneState{
Object: controlPlane1.DeepCopy(),
// Note this creation would be blocked by the validation Webhook. MHC with no MachineInfrastructure is not allowed.
MachineHealthCheck: mhcBuilder.Build()},
desired: &scope.ControlPlaneState{
Object: controlPlane1.DeepCopy(),
// ControlPlane does not have defined MachineInfrastructure.
//InfrastructureMachineTemplate: infrastructureMachineTemplate.DeepCopy(),
},
want: nil,
},
{
name: "Should update ControlPlane MachineHealthCheck when changed in desired state",
class: ccWithControlPlaneInfrastructure,
current: &scope.ControlPlaneState{
Object: controlPlane1.DeepCopy(),
InfrastructureMachineTemplate: infrastructureMachineTemplate.DeepCopy(),
MachineHealthCheck: mhcBuilder.Build()},
desired: &scope.ControlPlaneState{
Object: controlPlane1.DeepCopy(),
InfrastructureMachineTemplate: infrastructureMachineTemplate.DeepCopy(),
MachineHealthCheck: mhcBuilder.WithMaxUnhealthy(&maxUnhealthy).Build(),
},
// Want to get the updated version of the MachineHealthCheck after reconciliation.
want: mhcBuilder.WithMaxUnhealthy(&maxUnhealthy).Build(),
},
{
name: "Should delete ControlPlane MachineHealthCheck when removed from desired state",
class: ccWithControlPlaneInfrastructure,
current: &scope.ControlPlaneState{
Object: controlPlane1.DeepCopy(),
InfrastructureMachineTemplate: infrastructureMachineTemplate.DeepCopy(),
MachineHealthCheck: mhcBuilder.Build()},
desired: &scope.ControlPlaneState{
Object: controlPlane1.DeepCopy(),
InfrastructureMachineTemplate: infrastructureMachineTemplate.DeepCopy(),
// MachineHealthCheck removed from the desired state of the ControlPlane
},
want: nil,
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
fakeObjs := make([]client.Object, 0)
s := scope.New(builder.Cluster(metav1.NamespaceDefault, "cluster1").Build())
s.Blueprint = &scope.ClusterBlueprint{
ClusterClass: &clusterv1.ClusterClass{},
}
if tt.class.InfrastructureMachineTemplate != nil {
s.Blueprint.ClusterClass.Spec.ControlPlane.MachineInfrastructure = &clusterv1.LocalObjectTemplate{
Ref: contract.ObjToRef(tt.class.InfrastructureMachineTemplate),
}
}
s.Current.ControlPlane = &scope.ControlPlaneState{}
if tt.current != nil {
s.Current.ControlPlane = tt.current
if tt.current.Object != nil {
fakeObjs = append(fakeObjs, tt.current.Object)
}
if tt.current.InfrastructureMachineTemplate != nil {
fakeObjs = append(fakeObjs, tt.current.InfrastructureMachineTemplate)
}
if tt.current.MachineHealthCheck != nil {
fakeObjs = append(fakeObjs, tt.current.MachineHealthCheck)
}
}
fakeClient := fake.NewClientBuilder().
WithScheme(fakeScheme).
WithObjects(fakeObjs...).
Build()
r := Reconciler{
Client: fakeClient,
recorder: env.GetEventRecorderFor("test"),
}
s.Desired = &scope.ClusterState{
ControlPlane: tt.desired,
}
// Run reconcileControlPlane with the states created in the initial section of the test.
err := r.reconcileControlPlane(ctx, s)
g.Expect(err).ToNot(HaveOccurred())
// Create MachineHealthCheck object for fetching data into
gotMHC := &clusterv1.MachineHealthCheck{}
err = fakeClient.Get(ctx, client.ObjectKey{Namespace: controlPlane1.GetNamespace(), Name: controlPlane1.GetName()}, gotMHC)
// Nil case: If we want to find nothing (i.e. delete or MHC not created) and the Get call returns a NotFound error from the API the test succeeds.
if tt.want == nil && apierrors.IsNotFound(err) {
return
}
g.Expect(err).ToNot(HaveOccurred())
g.Expect(gotMHC).To(EqualObject(tt.want, IgnoreAutogeneratedMetadata))
})
}
} | explode_data.jsonl/11661 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 2241
} | [
2830,
3393,
693,
40446,
457,
3273,
34570,
21605,
14542,
3973,
1155,
353,
8840,
836,
8,
341,
3174,
1669,
1532,
2354,
51,
1155,
340,
197,
322,
4230,
44487,
21605,
51195,
369,
1273,
5048,
198,
197,
13573,
10314,
21605,
7275,
1669,
7363,
40... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 8 |
func TestOccupancyRepository(t *testing.T) {
test.IntegrationTest(t)
occupancies := []*Occupancy{
{
PoolID: "1",
Component: "cp1",
Capacity: 50,
},
{
PoolID: "2",
Component: "cp2",
Capacity: 100,
},
{
PoolID: "3",
Component: "cp3",
Capacity: 150,
},
}
testCases := []testCase{
{
"create occupancy with 0 running workers",
func(t *testing.T, occupancyRepo Repository) {
poolID := uuid.NewString()
occupEntity, err := occupancyRepo.CreateWorkerPoolOccupancy(poolID, "component1", 0, 50)
require.NoError(t, err)
require.Equal(t, poolID, occupEntity.WorkerPoolID)
require.Equal(t, 50, int(occupEntity.WorkerPoolCapacity))
require.Equal(t, 0, int(occupEntity.RunningWorkers))
},
},
{
"create occupancy with 10 running workers",
func(t *testing.T, occupancyRepo Repository) {
poolID := uuid.NewString()
occupEntity, err := occupancyRepo.CreateWorkerPoolOccupancy(poolID, "component1", 10, 50)
require.NoError(t, err)
require.Equal(t, poolID, occupEntity.WorkerPoolID)
require.Equal(t, 50, int(occupEntity.WorkerPoolCapacity))
require.Equal(t, 10, int(occupEntity.RunningWorkers))
},
},
{
"update occupancy",
func(t *testing.T, occupancyRepo Repository) {
poolID := occupancies[0].PoolID
err := occupancyRepo.UpdateWorkerPoolOccupancy(poolID, 10)
require.NoError(t, err)
occupEntity, err := occupancyRepo.FindWorkerPoolOccupancyByID(poolID)
require.NoError(t, err)
require.Equal(t, 10, int(occupEntity.RunningWorkers))
},
},
{
"create or update occupancy: create a new one",
func(t *testing.T, occupancyRepo Repository) {
poolID := uuid.NewString()
created, err := occupancyRepo.CreateOrUpdateWorkerPoolOccupancy(poolID, "dummy", 10, 50)
require.NoError(t, err)
require.Equal(t, true, created)
occupEntity, err := occupancyRepo.FindWorkerPoolOccupancyByID(poolID)
require.NoError(t, err)
require.Equal(t, 10, int(occupEntity.RunningWorkers))
require.Equal(t, poolID, occupEntity.WorkerPoolID)
require.Equal(t, 50, int(occupEntity.WorkerPoolCapacity))
},
},
{
"create or update occupancy: update an existing one with correct name and poolSize",
func(t *testing.T, occupancyRepo Repository) {
poolID := occupancies[1].PoolID
created, err := occupancyRepo.CreateOrUpdateWorkerPoolOccupancy(poolID, "cp2", 10, 100)
require.NoError(t, err)
require.Equal(t, false, created)
occupEntity, err := occupancyRepo.FindWorkerPoolOccupancyByID(poolID)
require.NoError(t, err)
require.Equal(t, 10, int(occupEntity.RunningWorkers))
require.Equal(t, poolID, occupEntity.WorkerPoolID)
require.Equal(t, 100, int(occupEntity.WorkerPoolCapacity))
},
},
{
"create or update occupancy: update an existing one with incorrect name",
func(t *testing.T, occupancyRepo Repository) {
poolID := occupancies[1].PoolID
created, err := occupancyRepo.CreateOrUpdateWorkerPoolOccupancy(poolID, "dummy", 10, 100)
require.Error(t, err)
require.Equal(t, false, created)
occupEntity, err := occupancyRepo.FindWorkerPoolOccupancyByID(poolID)
require.NoError(t, err)
require.Equal(t, 0, int(occupEntity.RunningWorkers))
require.Equal(t, 100, int(occupEntity.WorkerPoolCapacity))
},
},
{
"create or update occupancy: update an existing one with incorrect poolSize",
func(t *testing.T, occupancyRepo Repository) {
poolID := occupancies[1].PoolID
created, err := occupancyRepo.CreateOrUpdateWorkerPoolOccupancy(poolID, "cp2", 10, 50)
require.Error(t, err)
require.Equal(t, false, created)
occupEntity, err := occupancyRepo.FindWorkerPoolOccupancyByID(poolID)
require.NoError(t, err)
require.Equal(t, 0, int(occupEntity.RunningWorkers))
require.Equal(t, 100, int(occupEntity.WorkerPoolCapacity))
},
},
{
"get components that registered their occupancy",
func(t *testing.T, occupancyRepo Repository) {
componentList, err := occupancyRepo.GetComponentList()
require.NoError(t, err)
expectedComponents := []string{"cp1", "cp2", "cp3"}
require.ElementsMatch(t, expectedComponents, componentList)
},
},
{
"get worker pool IDs for components that registered their occupancy",
func(t *testing.T, occupancyRepo Repository) {
componentIDs, err := occupancyRepo.GetWorkerPoolIDs()
require.NoError(t, err)
expectedComponentIDs := []string{"1", "2", "3"}
require.ElementsMatch(t, expectedComponentIDs, componentIDs)
},
},
{
"get mean occupancy that is running many worker pools",
func(t *testing.T, occupancyRepo Repository) {
component := occupancies[0].Component
firstPoolID := occupancies[0].PoolID
err := occupancyRepo.UpdateWorkerPoolOccupancy(firstPoolID, 40)
require.NoError(t, err)
secondPoolID := "4"
_, err = occupancyRepo.CreateWorkerPoolOccupancy(secondPoolID, component, 0, 50)
require.NoError(t, err)
err = occupancyRepo.UpdateWorkerPoolOccupancy(secondPoolID, 10)
require.NoError(t, err)
meanOccupancy, err := occupancyRepo.GetMeanWorkerPoolOccupancyByComponent(component)
require.NoError(t, err)
require.Equal(t, 50.0, meanOccupancy)
},
},
}
occupancyRepo := newPersistentRepository(t)
for _, tc := range testCases {
unitTestSetup(t, occupancyRepo, occupancies)
t.Run(tc.name, newTestFct(tc, occupancyRepo))
testCleanUp(t, occupancyRepo)
}
} | explode_data.jsonl/13465 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 2181
} | [
2830,
3393,
63968,
6572,
4624,
1155,
353,
8840,
836,
8,
341,
18185,
7371,
17376,
2271,
1155,
340,
197,
23785,
31637,
1669,
29838,
63968,
6572,
515,
197,
197,
515,
298,
10025,
1749,
915,
25,
262,
330,
16,
756,
298,
197,
2189,
25,
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 TestReadRESTReq(t *testing.T) {
t.Parallel()
reqBody := ioutil.NopCloser(strings.NewReader(`{"chain_id":"alessio","memo":"text"}`))
req := &http.Request{Body: reqBody}
w := httptest.NewRecorder()
var br rest.BaseReq
// test OK
rest.ReadRESTReq(w, req, codec.New(), &br)
res := w.Result() //nolint:bodyclose
t.Cleanup(func() { res.Body.Close() })
require.Equal(t, rest.BaseReq{ChainID: "alessio", Memo: "text"}, br)
require.Equal(t, http.StatusOK, res.StatusCode)
// test non valid JSON
reqBody = ioutil.NopCloser(strings.NewReader(`MALFORMED`))
req = &http.Request{Body: reqBody}
br = rest.BaseReq{}
w = httptest.NewRecorder()
rest.ReadRESTReq(w, req, codec.New(), &br)
require.Equal(t, br, br)
res = w.Result() //nolint:bodyclose
t.Cleanup(func() { res.Body.Close() })
require.Equal(t, http.StatusBadRequest, res.StatusCode)
} | explode_data.jsonl/55930 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 358
} | [
2830,
3393,
4418,
38307,
27234,
1155,
353,
8840,
836,
8,
341,
3244,
41288,
7957,
741,
24395,
5444,
1669,
43144,
2067,
453,
51236,
799,
51442,
68587,
5809,
4913,
8819,
842,
3252,
64,
1717,
815,
2198,
55409,
3252,
1318,
1,
5541,
1171,
243... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestInvalidQuery(t *testing.T) {
ctx := context.Background()
// We detect that these queries are invalid before they reach the driver.
c := &Collection{}
for _, test := range []struct {
desc string
appliesToGet bool
q *Query
contains string // error text must contain this string
}{
{"negative Limit", true, c.Query().Limit(-1), "limit"},
{"zero Limit", true, c.Query().Limit(0), "limit"},
{"two Limits", true, c.Query().Limit(1).Limit(2), "limit"},
{"empty OrderBy field", true, c.Query().OrderBy("", Ascending), "empty field"},
{"bad OrderBy direction", true, c.Query().OrderBy("x", "y"), "direction"},
{"two OrderBys", true, c.Query().OrderBy("x", Ascending).OrderBy("y", Descending), "orderby"},
{"OrderBy not in Where", true, c.Query().OrderBy("x", Ascending).Where("y", ">", 1), "orderby"},
{"any Limit", false, c.Query().Limit(1), "limit"},
{"any OrderBy", false, c.Query().OrderBy("x", Descending), "orderby"},
} {
check := func(err error) {
if gcerrors.Code(err) != gcerrors.InvalidArgument {
t.Errorf("%s: got %v, want InvalidArgument", test.desc, err)
return
}
if !strings.Contains(strings.ToLower(err.Error()), test.contains) {
t.Errorf("%s: got %q, wanted it to contain %q", test.desc, err.Error(), test.contains)
}
}
if test.appliesToGet {
check(test.q.Get(ctx).Next(ctx, nil))
}
check(test.q.Delete(ctx))
check(test.q.Update(ctx, nil))
}
} | explode_data.jsonl/77566 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 564
} | [
2830,
3393,
7928,
2859,
1155,
353,
8840,
836,
8,
341,
20985,
1669,
2266,
19047,
741,
197,
322,
1205,
11140,
429,
1493,
19556,
525,
8318,
1573,
807,
5545,
279,
5579,
624,
1444,
1669,
609,
6482,
31483,
2023,
8358,
1273,
1669,
2088,
3056,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
func TestVerifyCert(t *testing.T) {
t.Parallel()
tester := []struct {
PEMType string
CreateBypass bool
NotAfter time.Time
ErrorExpected error
}{
{
ErrorExpected: nil,
},
{
CreateBypass: true,
ErrorExpected: errCertDataIsNil,
},
{
PEMType: "MEOW",
ErrorExpected: errCertTypeInvalid,
},
{
NotAfter: time.Now().Add(-time.Hour),
ErrorExpected: errCertExpired,
},
}
for x := range tester {
var cert []byte
var err error
if !tester[x].CreateBypass {
cert, err = mockCert(tester[x].PEMType, tester[x].NotAfter)
if err != nil {
t.Errorf("test %d unexpected error: %s", x, err)
continue
}
}
err = verifyCert(cert)
if err != tester[x].ErrorExpected {
t.Fatalf("test %d expected %v, got %v", x, tester[x].ErrorExpected, err)
}
}
} | explode_data.jsonl/59242 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 387
} | [
2830,
3393,
32627,
36934,
1155,
353,
8840,
836,
8,
341,
3244,
41288,
7957,
2822,
18185,
261,
1669,
3056,
1235,
341,
197,
197,
1740,
44,
929,
981,
914,
198,
197,
75569,
33,
49911,
220,
1807,
198,
197,
197,
2623,
6025,
414,
882,
16299,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestGetTime(t *testing.T) {
for _, tt := range []struct {
name string
time string
wantYear int
wantMonth time.Month
wantDay int
wantHour int
wantMin int
wantSec int
wantNsec int
location *time.Location
wantErr string
}{
{
name: "WithoutOpt",
time: "11220405",
wantYear: time.Now().Year(),
wantMonth: time.Month(11),
wantDay: 22,
wantHour: 4,
wantMin: 05,
wantSec: time.Now().Second(),
location: time.Local,
},
{
name: "WithOpt-2",
time: "1122040520",
wantYear: 2020,
wantMonth: time.Month(11),
wantDay: 22,
wantHour: 4,
wantMin: 05,
wantSec: time.Now().Second(),
location: time.Local,
},
{
name: "WithOpt-3",
time: "11220405202",
wantYear: time.Now().Year(),
wantMonth: time.Month(11),
wantDay: 22,
wantHour: 4,
wantMin: 05,
wantSec: 02,
location: time.Local,
},
{
name: "WithOpt-4",
time: "112204052022",
wantYear: 2022,
wantMonth: time.Month(11),
wantDay: 22,
wantHour: 4,
wantMin: 5,
wantSec: time.Now().Second(),
location: time.Local,
},
{
name: "WithOpt-5",
time: "1122040520221",
wantYear: 2020,
wantMonth: time.Month(11),
wantDay: 22,
wantHour: 4,
wantMin: 5,
wantSec: 21,
location: time.UTC,
},
{
name: "WithOpt-all",
time: "112204052022.55",
wantYear: 2022,
wantMonth: time.Month(11),
wantDay: 22,
wantHour: 4,
wantMin: 5,
wantSec: 55,
location: time.Local,
},
{
name: "WithOpt-all",
time: "11223344201135",
location: time.Local,
wantErr: "instead of [[CC]YY][.ss]",
},
} {
t.Run(tt.name, func(t *testing.T) {
testTime, err := getTime(tt.location, tt.time)
if err != nil {
if !strings.Contains(err.Error(), tt.wantErr) {
t.Errorf("%q failed. Got: %q, Want: %q", tt.name, err, tt.wantErr)
}
}
compareTime := time.Date(tt.wantYear, time.Month(tt.wantMonth), tt.wantDay, tt.wantHour, tt.wantMin, tt.wantSec, tt.wantNsec, tt.location).String()
if err == nil && !strings.Contains(compareTime, testTime.String()) {
t.Errorf("test %q failed. Got: %q, Want: %q", tt.name, testTime, compareTime)
}
})
}
} | explode_data.jsonl/70061 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 1194
} | [
2830,
3393,
1949,
1462,
1155,
353,
8840,
836,
8,
341,
2023,
8358,
17853,
1669,
2088,
3056,
1235,
341,
197,
11609,
414,
914,
198,
197,
21957,
414,
914,
198,
197,
50780,
9490,
220,
526,
198,
197,
50780,
11318,
882,
48383,
198,
197,
5078... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestMessageToQueryParametersWellKnownTypes(t *testing.T) {
type test struct {
MsgDescs []*descriptorpb.DescriptorProto
WellKnownMsgDescs []*descriptorpb.DescriptorProto
Message string
Params []openapiParameterObject
}
tests := []test{
{
MsgDescs: []*descriptorpb.DescriptorProto{
{
Name: proto.String("ExampleMessage"),
Field: []*descriptorpb.FieldDescriptorProto{
{
Name: proto.String("a_field_mask"),
Type: descriptorpb.FieldDescriptorProto_TYPE_MESSAGE.Enum(),
TypeName: proto.String(".google.protobuf.FieldMask"),
Number: proto.Int32(1),
},
{
Name: proto.String("a_timestamp"),
Type: descriptorpb.FieldDescriptorProto_TYPE_MESSAGE.Enum(),
TypeName: proto.String(".google.protobuf.Timestamp"),
Number: proto.Int32(2),
},
},
},
},
WellKnownMsgDescs: []*descriptorpb.DescriptorProto{
{
Name: proto.String("FieldMask"),
Field: []*descriptorpb.FieldDescriptorProto{
{
Name: proto.String("paths"),
Type: descriptorpb.FieldDescriptorProto_TYPE_STRING.Enum(),
Label: descriptorpb.FieldDescriptorProto_LABEL_REPEATED.Enum(),
Number: proto.Int32(1),
},
},
},
{
Name: proto.String("Timestamp"),
Field: []*descriptorpb.FieldDescriptorProto{
{
Name: proto.String("seconds"),
Type: descriptorpb.FieldDescriptorProto_TYPE_INT64.Enum(),
Number: proto.Int32(1),
},
{
Name: proto.String("nanos"),
Type: descriptorpb.FieldDescriptorProto_TYPE_INT32.Enum(),
Number: proto.Int32(2),
},
},
},
},
Message: "ExampleMessage",
Params: []openapiParameterObject{
{
Name: "a_field_mask",
In: "query",
Required: false,
Type: "string",
},
{
Name: "a_timestamp",
In: "query",
Required: false,
Type: "string",
Format: "date-time",
},
},
},
}
for _, test := range tests {
reg := descriptor.NewRegistry()
reg.SetEnumsAsInts(true)
err := reg.Load(&pluginpb.CodeGeneratorRequest{
ProtoFile: []*descriptorpb.FileDescriptorProto{
{
SourceCodeInfo: &descriptorpb.SourceCodeInfo{},
Name: proto.String("google/well_known.proto"),
Package: proto.String("google.protobuf"),
Dependency: []string{},
MessageType: test.WellKnownMsgDescs,
Service: []*descriptorpb.ServiceDescriptorProto{},
Options: &descriptorpb.FileOptions{
GoPackage: proto.String("google/well_known"),
},
},
{
SourceCodeInfo: &descriptorpb.SourceCodeInfo{},
Name: proto.String("acme/example.proto"),
Package: proto.String("example"),
Dependency: []string{"google/well_known.proto"},
MessageType: test.MsgDescs,
Service: []*descriptorpb.ServiceDescriptorProto{},
Options: &descriptorpb.FileOptions{
GoPackage: proto.String("acme/example"),
},
},
},
})
if err != nil {
t.Fatalf("failed to load CodeGeneratorRequest: %v", err)
}
message, err := reg.LookupMsg("", ".example."+test.Message)
if err != nil {
t.Fatalf("failed to lookup message: %s", err)
}
params, err := messageToQueryParameters(message, reg, []descriptor.Parameter{}, nil)
if err != nil {
t.Fatalf("failed to convert message to query parameters: %s", err)
}
if !reflect.DeepEqual(params, test.Params) {
t.Errorf("expected %v, got %v", test.Params, params)
}
}
} | explode_data.jsonl/32786 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 1738
} | [
2830,
3393,
2052,
1249,
2859,
9706,
11395,
48206,
4173,
1155,
353,
8840,
836,
8,
341,
13158,
1273,
2036,
341,
197,
197,
6611,
11065,
82,
688,
29838,
53132,
16650,
23548,
6820,
31549,
198,
197,
197,
11395,
48206,
6611,
11065,
82,
29838,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestUpdateEndpoints(t *testing.T) {
t.Parallel()
conn2Endpoint := make(map[string]string)
connFactory := func(endpoint string) (*grpc.ClientConn, error) {
conn := &grpc.ClientConn{}
conn2Endpoint[fmt.Sprintf("%p", conn)] = endpoint
return conn, nil
}
// Create a producer with a single endpoint
producer := NewConnectionProducer(connFactory, []string{"a"})
conn, a, err := producer.NewConnection()
assert.NoError(t, err)
assert.Equal(t, "a", conn2Endpoint[fmt.Sprintf("%p", conn)])
assert.Equal(t, "a", a)
// Now update the endpoint and check that when we create a new connection,
// we don't connect to the previous endpoint
producer.UpdateEndpoints([]string{"b"})
conn, b, err := producer.NewConnection()
assert.NoError(t, err)
assert.NotEqual(t, "a", conn2Endpoint[fmt.Sprintf("%p", conn)])
assert.Equal(t, "b", conn2Endpoint[fmt.Sprintf("%p", conn)])
assert.Equal(t, "b", b)
// Next, ensure an empty update is ignored
producer.UpdateEndpoints([]string{})
conn, _, err = producer.NewConnection()
assert.Equal(t, "b", conn2Endpoint[fmt.Sprintf("%p", conn)])
} | explode_data.jsonl/63953 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 404
} | [
2830,
3393,
4289,
80786,
1155,
353,
8840,
836,
8,
341,
3244,
41288,
7957,
741,
32917,
17,
27380,
1669,
1281,
9147,
14032,
30953,
340,
32917,
4153,
1669,
2915,
54869,
914,
8,
4609,
56585,
11716,
9701,
11,
1465,
8,
341,
197,
32917,
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 TestIdentity(t *testing.T) {
store, clean := testkit.CreateMockStore(t)
defer clean()
tk := testkit.NewTestKit(t, store)
tk.MustExec(`use test;`)
tk.MustExec(`drop table if exists identity;`)
tk.MustExec(`create table identity (id int not null primary key auto_increment);`)
tk.MustQuery("SELECT @@identity;").Check(testkit.Rows("0"))
tk.MustExec(`INSERT INTO identity VALUES (NULL);`)
tk.MustQuery("SELECT @@identity, LAST_INSERT_ID()").Check(testkit.Rows("1 1"))
tk.MustExec(`INSERT INTO identity VALUES (NULL);`)
tk.MustQuery("SELECT @@identity, LAST_INSERT_ID()").Check(testkit.Rows("2 2"))
tk.MustExec(`INSERT INTO identity VALUES (NULL);`)
tk.MustQuery("SELECT @@identity, LAST_INSERT_ID()").Check(testkit.Rows("3 3"))
} | explode_data.jsonl/65610 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 278
} | [
2830,
3393,
18558,
1155,
353,
8840,
836,
8,
341,
57279,
11,
4240,
1669,
1273,
8226,
7251,
11571,
6093,
1155,
340,
16867,
4240,
2822,
3244,
74,
1669,
1273,
8226,
7121,
2271,
7695,
1155,
11,
3553,
340,
3244,
74,
50463,
10216,
5809,
810,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestTableLongData(t *testing.T) {
NewTable().Header([]string{"h1", "h2", "h3"}).
Data([][]string{{"short", "long-long-long-long-long", "short"}}).Flush()
} | explode_data.jsonl/69435 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 68
} | [
2830,
3393,
2556,
6583,
1043,
1155,
353,
8840,
836,
8,
341,
197,
3564,
2556,
1005,
4047,
10556,
917,
4913,
71,
16,
497,
330,
71,
17,
497,
330,
71,
18,
9207,
4292,
197,
40927,
10556,
1294,
917,
2979,
1,
8676,
497,
330,
4825,
23791,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestInheritsDifferentHost(t *testing.T) {
in1 := "http://www.test.com/doc.json"
in2 := "http://www.test2.com/doc.json#bla"
r1, _ := New(in1)
r2, _ := New(in2)
result, err := r1.Inherits(r2)
if err != nil {
t.Errorf("Inherits(%s,%s) should not fail. Error: %s", r1.String(), r2.String(), err.Error())
}
if result.String() != in2 {
t.Errorf("Inherits(%s,%s) should be %s but is %s", in1, in2, in2, result)
}
if result.GetPointer().String() != "" {
t.Errorf("result(%v)::GetPointer() %v expect %v", result.String(), result.GetPointer().String(), "")
}
} | explode_data.jsonl/13770 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 255
} | [
2830,
3393,
641,
38693,
69123,
9296,
1155,
353,
8840,
836,
8,
1476,
17430,
16,
1669,
330,
1254,
1110,
2136,
5958,
905,
39510,
4323,
698,
17430,
17,
1669,
330,
1254,
1110,
2136,
5958,
17,
905,
39510,
4323,
2,
64726,
1837,
7000,
16,
11,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 4 |
func TestControllerPublishVolume(t *testing.T) {
d, err := NewFakeDriver(t)
d.cloud = &azure.Cloud{}
if err != nil {
t.Fatalf("Error getting driver: %v", err)
}
volumeCap := csi.VolumeCapability_AccessMode{Mode: 2}
volumeCapWrong := csi.VolumeCapability_AccessMode{Mode: 10}
tests := []struct {
desc string
req *csi.ControllerPublishVolumeRequest
expectedErr error
}{
{
desc: "Volume ID missing",
req: &csi.ControllerPublishVolumeRequest{},
expectedErr: status.Error(codes.InvalidArgument, "Volume ID not provided"),
},
{
desc: "Volume capability missing",
req: &csi.ControllerPublishVolumeRequest{
VolumeId: "vol_1",
},
expectedErr: status.Error(codes.InvalidArgument, "Volume capability not provided"),
},
{
desc: "Volume capability not supported",
req: &csi.ControllerPublishVolumeRequest{
VolumeId: "vol_1",
VolumeCapability: &csi.VolumeCapability{AccessMode: &volumeCapWrong},
},
expectedErr: status.Error(codes.InvalidArgument, "Volume capability not supported"),
},
{
desc: "diskName error",
req: &csi.ControllerPublishVolumeRequest{
VolumeId: "vol_1",
VolumeCapability: &csi.VolumeCapability{AccessMode: &volumeCap},
},
expectedErr: status.Error(codes.NotFound, "Volume not found, failed with error: could not get disk name from vol_1, correct format: (?i).*/subscriptions/(?:.*)/resourceGroups/(?:.*)/providers/Microsoft.Compute/disks/(.+)"),
},
{
desc: "NodeID missing",
req: &csi.ControllerPublishVolumeRequest{
VolumeId: testVolumeID,
VolumeCapability: &csi.VolumeCapability{AccessMode: &volumeCap},
},
expectedErr: status.Error(codes.InvalidArgument, "Node ID not provided"),
},
}
for _, test := range tests {
id := test.req.VolumeId
disk := compute.Disk{
ID: &id,
}
ctrl := gomock.NewController(t)
defer ctrl.Finish()
mockDiskClient := mockdiskclient.NewMockInterface(ctrl)
d.cloud = &azure.Cloud{}
d.cloud.DisksClient = mockDiskClient
mockDiskClient.EXPECT().Get(gomock.Any(), gomock.Any(), gomock.Any()).Return(disk, nil).AnyTimes()
_, err := d.ControllerPublishVolume(context.Background(), test.req)
if !reflect.DeepEqual(err, test.expectedErr) {
t.Errorf("desc: %s\n actualErr: (%v), expectedErr: (%v)", test.desc, err, test.expectedErr)
}
}
} | explode_data.jsonl/59384 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 934
} | [
2830,
3393,
2051,
50145,
18902,
1155,
353,
8840,
836,
8,
341,
2698,
11,
1848,
1669,
1532,
52317,
11349,
1155,
340,
2698,
16935,
284,
609,
39495,
94492,
16094,
743,
1848,
961,
2092,
341,
197,
3244,
30762,
445,
1454,
3709,
5579,
25,
1018,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestNoOp_ExecuteInbound(t *testing.T) {
followup, action, err := (&noOp{}).ExecuteInbound(&metaData{})
require.Contains(t, fmt.Sprintf("%v", err), "cannot execute no-op")
require.Nil(t, followup)
require.Nil(t, action)
} | explode_data.jsonl/52998 | {
"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,
2753,
7125,
83453,
641,
10891,
1155,
353,
8840,
836,
8,
341,
1166,
1544,
454,
11,
1917,
11,
1848,
1669,
15899,
2152,
7125,
6257,
568,
17174,
641,
10891,
2099,
5490,
1043,
37790,
17957,
11545,
1155,
11,
8879,
17305,
4430,
85,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestAverageNumber(t *testing.T) {
for _, tc := range averageNumberTestCases {
s := tc.String
expected := tc.Average
expectedErr := tc.Error
got, err := strings.AverageNumber(s)
if expected != got {
t.Errorf("%q: expected %v, got %v", s, expected, got)
}
if expectedErr != err {
t.Errorf("%q: expected error %v, got %v", s, expectedErr, err)
}
}
} | explode_data.jsonl/12029 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 152
} | [
2830,
3393,
26292,
2833,
1155,
353,
8840,
836,
8,
341,
2023,
8358,
17130,
1669,
2088,
5461,
2833,
2271,
37302,
341,
197,
1903,
1669,
17130,
6431,
198,
197,
42400,
1669,
17130,
875,
4355,
198,
197,
42400,
7747,
1669,
17130,
6141,
198,
19... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 4 |
func TestAttachVolume(t *testing.T) {
volumeDriverName := "fake1"
dir, err := ioutil.TempDir("", "TestCreateVolume")
if err != nil {
t.Fatal(err)
}
defer os.RemoveAll(dir)
// create volume core
core, err := createVolumeCore(dir)
if err != nil {
t.Fatal(err)
}
driverName1 := "fake1"
volumeName1 := "test1"
vID1 := types.VolumeContext{Name: volumeName1, Driver: driverName1}
driver.Register(driver.NewFakeDriver(volumeDriverName))
defer driver.Unregister(volumeDriverName)
extra := map[string]string{}
v0, err0 := core.AttachVolume(vID1, extra)
if v0 != nil {
t.Fatalf("expect get volume nil, but got a volume with name %s", v0.Name)
}
if !errtypes.IsVolumeNotFound(err0) {
if err0 == nil {
t.Fatal("expect get volume not found error, but err is nil")
} else {
t.Fatalf("expect get volume not found error, but got %v", err0)
}
}
core.CreateVolume(types.VolumeContext{Name: "test1", Driver: volumeDriverName})
v1, err1 := core.AttachVolume(vID1, extra)
if err1 != nil {
t.Fatalf("attach volume error: %v", err1)
}
if v1.Name != volumeName1 {
t.Fatalf("expect volume name is %s, but got %s", volumeName1, v1.Name)
}
if v1.Driver() != driverName1 {
t.Fatalf("expect volume driver is %s, but got %s", driverName1, v1.Driver())
}
} | explode_data.jsonl/51636 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 501
} | [
2830,
3393,
30485,
18902,
1155,
353,
8840,
836,
8,
341,
5195,
4661,
11349,
675,
1669,
330,
30570,
16,
1837,
48532,
11,
1848,
1669,
43144,
65009,
6184,
19814,
330,
2271,
4021,
18902,
1138,
743,
1848,
961,
2092,
341,
197,
3244,
26133,
396... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 Test_New(t *testing.T) {
t.Parallel()
a := assert.New(t)
provider := deezerProvider()
a.Equal(provider.ClientKey, os.Getenv("DEEZER_KEY"))
a.Equal(provider.Secret, os.Getenv("DEEZER_SECRET"))
a.Equal(provider.CallbackURL, "/foo")
} | explode_data.jsonl/82096 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 107
} | [
2830,
3393,
39582,
1155,
353,
8840,
836,
8,
341,
3244,
41288,
7957,
741,
11323,
1669,
2060,
7121,
1155,
692,
197,
19979,
1669,
44733,
7070,
5179,
741,
11323,
12808,
50886,
11716,
1592,
11,
2643,
64883,
445,
1150,
97278,
640,
6600,
5455,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestInMemoryIndexCache_UpdateItem(t *testing.T) {
defer leaktest.CheckTimeout(t, 10*time.Second)()
const maxSize = 2 * (sliceHeaderSize + 1)
var errorLogs []string
errorLogger := log.LoggerFunc(func(kvs ...interface{}) error {
var lvl string
for i := 0; i < len(kvs); i += 2 {
if kvs[i] == "level" {
lvl = fmt.Sprint(kvs[i+1])
break
}
}
if lvl != "error" {
return nil
}
var buf bytes.Buffer
defer func() { errorLogs = append(errorLogs, buf.String()) }()
return log.NewLogfmtLogger(&buf).Log(kvs...)
})
metrics := prometheus.NewRegistry()
cache, err := NewInMemoryIndexCache(log.NewSyncLogger(errorLogger), metrics, Opts{
MaxItemSizeBytes: maxSize,
MaxSizeBytes: maxSize,
})
testutil.Ok(t, err)
uid := func(id uint64) ulid.ULID { return ulid.MustNew(id, nil) }
lbl := labels.Label{Name: "foo", Value: "bar"}
for _, tt := range []struct {
typ string
set func(uint64, []byte)
get func(uint64) ([]byte, bool)
}{
{
typ: cacheTypePostings,
set: func(id uint64, b []byte) { cache.StorePostings(uid(id), lbl, b) },
get: func(id uint64) ([]byte, bool) {
hits, _ := cache.FetchMultiPostings(uid(id), []labels.Label{lbl})
b, ok := hits[lbl]
return b, ok
},
},
{
typ: cacheTypeSeries,
set: func(id uint64, b []byte) { cache.StoreSeries(uid(id), id, b) },
get: func(id uint64) ([]byte, bool) {
hits, _ := cache.FetchMultiSeries(uid(id), []uint64{id})
b, ok := hits[id]
return b, ok
},
},
} {
t.Run(tt.typ, func(t *testing.T) {
defer func() { errorLogs = nil }()
// Set value.
tt.set(0, []byte{0})
buf, ok := tt.get(0)
testutil.Equals(t, true, ok)
testutil.Equals(t, []byte{0}, buf)
testutil.Equals(t, float64(sliceHeaderSize+1), promtest.ToFloat64(cache.currentSize.WithLabelValues(tt.typ)))
testutil.Equals(t, float64(1), promtest.ToFloat64(cache.current.WithLabelValues(tt.typ)))
testutil.Equals(t, []string(nil), errorLogs)
// Set the same value again.
// NB: This used to over-count the value.
tt.set(0, []byte{0})
buf, ok = tt.get(0)
testutil.Equals(t, true, ok)
testutil.Equals(t, []byte{0}, buf)
testutil.Equals(t, float64(sliceHeaderSize+1), promtest.ToFloat64(cache.currentSize.WithLabelValues(tt.typ)))
testutil.Equals(t, float64(1), promtest.ToFloat64(cache.current.WithLabelValues(tt.typ)))
testutil.Equals(t, []string(nil), errorLogs)
// Set a larger value.
// NB: This used to deadlock when enough values were over-counted and it
// couldn't clear enough space -- repeatedly removing oldest after empty.
tt.set(1, []byte{0, 1})
buf, ok = tt.get(1)
testutil.Equals(t, true, ok)
testutil.Equals(t, []byte{0, 1}, buf)
testutil.Equals(t, float64(sliceHeaderSize+2), promtest.ToFloat64(cache.currentSize.WithLabelValues(tt.typ)))
testutil.Equals(t, float64(1), promtest.ToFloat64(cache.current.WithLabelValues(tt.typ)))
testutil.Equals(t, []string(nil), errorLogs)
// Mutations to existing values will be ignored.
tt.set(1, []byte{1, 2})
buf, ok = tt.get(1)
testutil.Equals(t, true, ok)
testutil.Equals(t, []byte{0, 1}, buf)
testutil.Equals(t, float64(sliceHeaderSize+2), promtest.ToFloat64(cache.currentSize.WithLabelValues(tt.typ)))
testutil.Equals(t, float64(1), promtest.ToFloat64(cache.current.WithLabelValues(tt.typ)))
testutil.Equals(t, []string(nil), errorLogs)
})
}
} | explode_data.jsonl/1716 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 1463
} | [
2830,
3393,
641,
10642,
1552,
8233,
47393,
1234,
1155,
353,
8840,
836,
8,
341,
16867,
23352,
1944,
10600,
7636,
1155,
11,
220,
16,
15,
77053,
32435,
8,
2822,
4777,
61935,
284,
220,
17,
353,
320,
24963,
4047,
1695,
488,
220,
16,
692,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestSetIntIPv4Address(t *testing.T) {
d := setup()
ni := NetInterface{}
ni.IfNum = 1
ni, err := d.SetIntIPv4Address(ni) // this SHOULD err
isErr(t, err, "Uncaught test for blank IPv4Address or IPv4Netmask field")
ni.Name = "test-data-in"
ni.IPv4Address = "10.1.1.44"
ni.IPv4Netmask = "255.255.255.0"
ni, err = d.SetIntIPv4Address(ni)
notErr(t, err)
assert(t, ni.IPv4Address, "10.1.1.44")
assert(t, ni.IPv4Netmask, "255.255.255.0")
} | explode_data.jsonl/21119 | {
"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,
1649,
1072,
58056,
19,
4286,
1155,
353,
8840,
836,
8,
341,
2698,
1669,
6505,
741,
197,
7751,
1669,
9374,
5051,
16094,
197,
7751,
32901,
4651,
284,
220,
16,
198,
197,
7751,
11,
1848,
1669,
294,
84725,
58056,
19,
4286,
1445,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestSVGStyle(t *testing.T) {
svgTests := []struct {
svg string
expected string
}{
{`<style> a > b {} </style>`, `<style>a>b{}</style>`},
{`<style> <![CDATA[ @media x < y {} ]]> </style>`, `<style>@media x < y{}</style>`},
{`<style> <![CDATA[ * { content: '<<<<<'; } ]]> </style>`, `<style><![CDATA[*{content:'<<<<<'}]]></style>`},
{`<style/><![CDATA[ * { content: '<<<<<'; ]]>`, `<style/><![CDATA[ * { content: '<<<<<'; ]]>`},
{`<path style="fill: black; stroke: #ff0000;"/>`, `<path style="fill:#000;stroke:red"/>`},
}
m := minify.New()
m.AddFunc("text/css", css.Minify)
for _, tt := range svgTests {
t.Run(tt.svg, func(t *testing.T) {
r := bytes.NewBufferString(tt.svg)
w := &bytes.Buffer{}
err := Minify(m, w, r, nil)
test.Minify(t, tt.svg, err, w.String(), tt.expected)
})
}
} | explode_data.jsonl/7355 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 409
} | [
2830,
3393,
64397,
2323,
1155,
353,
8840,
836,
8,
341,
1903,
7239,
18200,
1669,
3056,
1235,
341,
197,
1903,
7239,
414,
914,
198,
197,
42400,
914,
198,
197,
59403,
197,
197,
90,
63,
27,
3528,
29,
264,
861,
293,
4687,
690,
3528,
29,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestRuntimeBase64(t *testing.T) {
modules := map[string]string{
"test": `
local nakama = require("nakama")
function test(ctx, payload)
return nakama.base64_decode(nakama.base64_encode(payload))
end
nakama.register_rpc(test, "test")`,
}
runtime, err := runtimeWithModules(t, modules)
if err != nil {
t.Fatal(err.Error())
}
fn := runtime.Rpc("test")
if fn == nil {
t.Fatal("Expected RPC function to be registered")
}
payload := "{\"key\":\"value\"}"
result, err, _ := fn(context.Background(), nil, "", "", nil, 0, "", "", "", payload)
if err != nil {
t.Fatal(err)
}
if result != payload {
t.Fatal("Invocation failed. Return result not expected", result)
}
} | explode_data.jsonl/59784 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 267
} | [
2830,
3393,
15123,
3978,
21,
19,
1155,
353,
8840,
836,
8,
341,
42228,
2425,
1669,
2415,
14032,
30953,
515,
197,
197,
1,
1944,
788,
22074,
2438,
40886,
3029,
284,
1373,
445,
42874,
3029,
1138,
1688,
1273,
7502,
11,
7729,
340,
853,
4088... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestVirtualServiceName(t *testing.T) {
actual := RoutingVirtualServiceName("inst1")
expected := "inst1--vs"
if diff := cmp.Diff(expected, actual); diff != "" {
t.Errorf("RoutingVirtualServiceName (-expected, +actual)\n%v", diff)
}
} | explode_data.jsonl/54874 | {
"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,
33026,
1860,
675,
1155,
353,
8840,
836,
8,
341,
88814,
1669,
65707,
33026,
1860,
675,
445,
6308,
16,
1138,
42400,
1669,
330,
6308,
16,
313,
11562,
698,
743,
3638,
1669,
26089,
98063,
15253,
11,
5042,
1215,
3638,
961,
1591,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestPluginSelectedMetrics(t *testing.T) {
t.Parallel()
s := &IllumosZpool{
Fields: []string{"cap", "health"},
}
zpoolOutput = func() string {
return sampleOutput
}
acc := testutil.Accumulator{}
require.NoError(t, s.Gather(&acc))
testutil.RequireMetricsEqual(
t,
testMetricsSelected,
acc.GetTelegrafMetrics(),
testutil.SortMetrics(),
testutil.IgnoreTime())
} | explode_data.jsonl/18985 | {
"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,
11546,
6316,
27328,
1155,
353,
8840,
836,
8,
341,
3244,
41288,
7957,
2822,
1903,
1669,
609,
40,
5448,
436,
57,
10285,
515,
197,
197,
8941,
25,
3056,
917,
4913,
11346,
497,
330,
12120,
7115,
197,
630,
20832,
10285,
5097,
28... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestIssue10804(t *testing.T) {
store, clean := testkit.CreateMockStore(t)
defer clean()
tk := testkit.NewTestKit(t, store)
tk.MustQuery(`SELECT @@information_schema_stats_expiry`).Check(testkit.Rows(`86400`))
tk.MustExec("/*!80000 SET SESSION information_schema_stats_expiry=0 */")
tk.MustQuery(`SELECT @@information_schema_stats_expiry`).Check(testkit.Rows(`0`))
tk.MustQuery(`SELECT @@GLOBAL.information_schema_stats_expiry`).Check(testkit.Rows(`86400`))
tk.MustExec("/*!80000 SET GLOBAL information_schema_stats_expiry=0 */")
tk.MustQuery(`SELECT @@GLOBAL.information_schema_stats_expiry`).Check(testkit.Rows(`0`))
} | explode_data.jsonl/65492 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 255
} | [
2830,
3393,
42006,
16,
15,
23,
15,
19,
1155,
353,
8840,
836,
8,
341,
57279,
11,
4240,
1669,
1273,
8226,
7251,
11571,
6093,
1155,
340,
16867,
4240,
2822,
3244,
74,
1669,
1273,
8226,
7121,
2271,
7695,
1155,
11,
3553,
340,
3244,
74,
50... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestHttpGet_Perform(t *testing.T) {
cases := []struct {
name string
status int
want string
wantErrored bool
response string
}{
{"success", 200, "results!", false, `results!`},
{"success but error in body", 200, `{"error": "results!"}`, false, `{"error": "results!"}`},
{"success with HTML", 200, `<html>results!</html>`, false, `<html>results!</html>`},
{"not found", 400, "inputValue", true, `<html>so bad</html>`},
{"server error", 400, "inputValue", true, `Invalid request`},
}
for _, tt := range cases {
test := tt
t.Run(test.name, func(t *testing.T) {
t.Parallel()
input := cltest.RunResultWithValue("inputValue")
mock, cleanup := cltest.NewHTTPMockServer(t, test.status, "GET", test.response,
func(body string) { assert.Equal(t, ``, body) })
defer cleanup()
hga := adapters.HTTPGet{URL: cltest.MustParseWebURL(mock.URL)}
result := hga.Perform(input, nil)
val, err := result.Value()
assert.Nil(t, err)
assert.Equal(t, test.want, val)
assert.Equal(t, test.wantErrored, result.HasError())
assert.Equal(t, false, result.Status.PendingBridge())
})
}
} | explode_data.jsonl/39119 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 472
} | [
2830,
3393,
29774,
53918,
627,
1155,
353,
8840,
836,
8,
341,
1444,
2264,
1669,
3056,
1235,
341,
197,
11609,
286,
914,
198,
197,
23847,
414,
526,
198,
197,
50780,
286,
914,
198,
197,
50780,
36560,
1151,
1807,
198,
197,
21735,
262,
914,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestEth_GetFilterChanges_Topics_AB(t *testing.T) {
time.Sleep(time.Second)
rpcRes := call(t, "eth_blockNumber", []string{})
var res hexutil.Uint64
err := res.UnmarshalJSON(rpcRes.Result)
require.NoError(t, err)
param := make([]map[string]interface{}, 1)
param[0] = make(map[string]interface{})
param[0]["topics"] = []string{helloTopic, worldTopic}
param[0]["fromBlock"] = res.String()
// instantiate new filter
rpcRes = call(t, "eth_newFilter", param)
var ID string
err = json.Unmarshal(rpcRes.Result, &ID)
require.NoError(t, err, string(rpcRes.Result))
deployTestContractWithFunction(t)
// get filter changes
changesRes := call(t, "eth_getFilterChanges", []string{ID})
var logs []*ethtypes.Log
err = json.Unmarshal(changesRes.Result, &logs)
require.NoError(t, err)
require.Equal(t, 1, len(logs))
} | explode_data.jsonl/860 | {
"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,
65390,
13614,
5632,
11317,
94819,
1211,
32643,
1155,
353,
8840,
836,
8,
341,
21957,
31586,
9730,
32435,
692,
7000,
3992,
1061,
1669,
1618,
1155,
11,
330,
769,
7113,
2833,
497,
3056,
917,
6257,
692,
2405,
592,
12371,
1314,
71... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_underscore_arrays_6(t *testing.T) {
tt(t, func() {
test, _ := test_()
test(`
test("without", function() {
var list = [1, 2, 1, 0, 3, 1, 4];
equal(_.without(list, 0, 1).join(', '), '2, 3, 4', 'can remove all instances of an object');
var result = (function(){ return _.without(arguments, 0, 1); })(1, 2, 1, 0, 3, 1, 4);
equal(result.join(', '), '2, 3, 4', 'works on an arguments object');
var list = [{one : 1}, {two : 2}];
ok(_.without(list, {one : 1}).length == 2, 'uses real object identity for comparisons.');
ok(_.without(list, list[0]).length == 1, 'ditto.');
});
`)
})
} | explode_data.jsonl/68900 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 285
} | [
2830,
3393,
62,
53933,
68983,
62,
21,
1155,
353,
8840,
836,
8,
972,
3244,
83,
1155,
11,
2915,
368,
972,
197,
18185,
11,
716,
1669,
1273,
62,
18005,
197,
18185,
5809,
319,
220,
1273,
445,
28996,
497,
729,
368,
972,
262,
762,
1140,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestUnterminatedString(t *testing.T) {
const rs = `rule unterminated_string {
meta:
description = "String missing a closing quote"
strings:
$s1 = "abcdefg
condition:
any of them
}`
_, err := parseRuleStr(rs)
unterminatedChecker(t, err)
} | explode_data.jsonl/17975 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 91
} | [
2830,
3393,
20250,
261,
51199,
703,
1155,
353,
8840,
836,
8,
341,
4777,
10036,
284,
1565,
12937,
21506,
51199,
3904,
341,
5490,
510,
42407,
284,
330,
703,
7402,
264,
15316,
12641,
698,
18594,
510,
197,
16337,
16,
284,
330,
41202,
70,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestFileWriterRolls(t *testing.T) {
maxRolls := 2
fw := NewFileWriter(t.Name()+".log", time.Second, maxRolls)
defer fw.Close()
fw.Write([]byte("test 1"))
time.Sleep(time.Second)
fw.Write([]byte("test 2"))
time.Sleep(time.Second)
fw.Write([]byte("test 3"))
} | explode_data.jsonl/74560 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 112
} | [
2830,
3393,
1703,
6492,
32355,
82,
1155,
353,
8840,
836,
8,
341,
22543,
32355,
82,
1669,
220,
17,
198,
1166,
86,
1669,
1532,
1703,
6492,
1155,
2967,
17140,
3263,
839,
497,
882,
32435,
11,
1932,
32355,
82,
340,
16867,
33886,
10421,
741... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestFromStringDisallowAll(t *testing.T) {
r, err := FromString("User-Agent: *\r\nDisallow: /\r\n")
require.NoError(t, err)
expectAll(t, r, false)
} | explode_data.jsonl/51673 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 67
} | [
2830,
3393,
44491,
87854,
2403,
1155,
353,
8840,
836,
8,
341,
7000,
11,
1848,
1669,
5542,
703,
445,
1474,
45118,
25,
87787,
81,
1699,
87854,
25,
23536,
81,
1699,
1138,
17957,
35699,
1155,
11,
1848,
340,
24952,
2403,
1155,
11,
435,
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 |
func TestStart_ExecuteOutbound(t *testing.T) {
followup, action, err := (&start{}).ExecuteOutbound(&metaData{})
require.Contains(t, fmt.Sprintf("%v", err), "is not implemented yet")
require.Nil(t, followup)
require.Nil(t, action)
} | explode_data.jsonl/52990 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 89
} | [
2830,
3393,
3479,
83453,
2662,
10891,
1155,
353,
8840,
836,
8,
341,
1166,
1544,
454,
11,
1917,
11,
1848,
1669,
15899,
2468,
6257,
568,
17174,
2662,
10891,
2099,
5490,
1043,
37790,
17957,
11545,
1155,
11,
8879,
17305,
4430,
85,
497,
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 |
func TestCreateDaisyInflater_File_UsesFallbackSizes_WhenInspectionFails(t *testing.T) {
source := fileSource{gcsPath: "gs://bucket/vmdk"}
inflater := createDaisyInflaterSafe(t, ImageImportRequest{
Source: source,
NoExternalIP: true,
}, imagefile.Metadata{})
daisyutils.CheckWorkflow(inflater.worker, func(wf *daisy.Workflow, err error) {
// The 10GB defaults are hardcoded in inflate_file.wf.json.
assert.Equal(t, "10", wf.Vars["scratch_disk_size_gb"].Value)
assert.Equal(t, "10", wf.Vars["inflated_disk_size_gb"].Value)
})
} | explode_data.jsonl/75633 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 225
} | [
2830,
3393,
4021,
35,
49056,
12342,
34061,
62,
68965,
87206,
34930,
62,
4498,
15474,
16076,
37,
6209,
1155,
353,
8840,
836,
8,
341,
47418,
1669,
1034,
3608,
90,
70,
4837,
1820,
25,
330,
5857,
1110,
30410,
5457,
2277,
74,
16707,
17430,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestJoinImageStreamTag(t *testing.T) {
if e, a := "foo:bar", JoinImageStreamTag("foo", "bar"); e != a {
t.Errorf("Unexpected value: %s", a)
}
if e, a := "foo:"+DefaultImageTag, JoinImageStreamTag("foo", ""); e != a {
t.Errorf("Unexpected value: %s", a)
}
} | explode_data.jsonl/40833 | {
"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,
12292,
1906,
3027,
5668,
1155,
353,
8840,
836,
8,
341,
743,
384,
11,
264,
1669,
330,
7975,
25,
2257,
497,
16471,
1906,
3027,
5668,
445,
7975,
497,
330,
2257,
5038,
384,
961,
264,
341,
197,
3244,
13080,
445,
29430,
897,
2... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
func TestUnMarshalCustomerStatementRequest(t *testing.T) {
s := `{"to": [{"name":"hello","email":"hello@invoiced.com"}],
"bcc": "sales@invoiced.com",
"subject": "Late Invoice",
"message": "Right world"
}`
so := new(EmailRequest)
err := json.Unmarshal([]byte(s), so)
if err != nil {
t.Fatal(err)
}
} | explode_data.jsonl/43692 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 130
} | [
2830,
3393,
1806,
55438,
12792,
8636,
1900,
1155,
353,
8840,
836,
8,
341,
1903,
1669,
1565,
4913,
983,
788,
61753,
606,
3252,
14990,
2198,
2332,
3252,
14990,
31,
258,
3334,
7572,
905,
9207,
1259,
220,
330,
69018,
788,
330,
29041,
31,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestDB_SnapshotWithDelete(t *testing.T) {
numSamples := int64(10)
db, delete := openTestDB(t, nil)
defer delete()
app := db.Appender()
smpls := make([]float64, numSamples)
for i := int64(0); i < numSamples; i++ {
smpls[i] = rand.Float64()
app.Add(labels.Labels{{Name: "a", Value: "b"}}, i, smpls[i])
}
testutil.Ok(t, app.Commit())
cases := []struct {
intervals Intervals
remaint []int64
}{
{
intervals: Intervals{{1, 3}, {4, 7}},
remaint: []int64{0, 8, 9},
},
}
Outer:
for _, c := range cases {
// TODO(gouthamve): Reset the tombstones somehow.
// Delete the ranges.
for _, r := range c.intervals {
testutil.Ok(t, db.Delete(r.Mint, r.Maxt, labels.NewEqualMatcher("a", "b")))
}
// create snapshot
snap, err := ioutil.TempDir("", "snap")
testutil.Ok(t, err)
defer func() {
testutil.Ok(t, os.RemoveAll(snap))
}()
testutil.Ok(t, db.Snapshot(snap, true))
testutil.Ok(t, db.Close())
// reopen DB from snapshot
db, err = Open(snap, nil, nil, nil)
testutil.Ok(t, err)
defer func() { testutil.Ok(t, db.Close()) }()
// Compare the result.
q, err := db.Querier(0, numSamples)
testutil.Ok(t, err)
defer func() { testutil.Ok(t, q.Close()) }()
res, err := q.Select(labels.NewEqualMatcher("a", "b"))
testutil.Ok(t, err)
expSamples := make([]tsdbutil.Sample, 0, len(c.remaint))
for _, ts := range c.remaint {
expSamples = append(expSamples, sample{ts, smpls[ts]})
}
expss := newMockSeriesSet([]Series{
newSeries(map[string]string{"a": "b"}, expSamples),
})
if len(expSamples) == 0 {
testutil.Assert(t, res.Next() == false, "")
continue
}
for {
eok, rok := expss.Next(), res.Next()
testutil.Equals(t, eok, rok)
if !eok {
continue Outer
}
sexp := expss.At()
sres := res.At()
testutil.Equals(t, sexp.Labels(), sres.Labels())
smplExp, errExp := expandSeriesIterator(sexp.Iterator())
smplRes, errRes := expandSeriesIterator(sres.Iterator())
testutil.Equals(t, errExp, errRes)
testutil.Equals(t, smplExp, smplRes)
}
}
} | explode_data.jsonl/64371 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 935
} | [
2830,
3393,
3506,
1098,
9601,
2354,
6435,
1155,
353,
8840,
836,
8,
341,
22431,
39571,
1669,
526,
21,
19,
7,
16,
15,
692,
20939,
11,
3698,
1669,
1787,
2271,
3506,
1155,
11,
2092,
340,
16867,
3698,
2822,
28236,
1669,
2927,
5105,
1659,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestCountCheckMerge(t *testing.T) {
for _, tc := range []struct {
desc string
opt1 *CountOptions
opt2 *CountOptions
returnResult1 bool
returnResult2 bool
wantErr bool
}{
{"same options, all fields filled",
&CountOptions{
Epsilon: ln3,
Delta: tenten,
MaxPartitionsContributed: 1,
Noise: noise.Gaussian(),
maxContributionsPerPartition: 2,
},
&CountOptions{
Epsilon: ln3,
Delta: tenten,
MaxPartitionsContributed: 1,
Noise: noise.Gaussian(),
maxContributionsPerPartition: 2,
},
false,
false,
false},
{"same options, only required fields filled",
&CountOptions{
Epsilon: ln3,
},
&CountOptions{
Epsilon: ln3,
},
false,
false,
false},
{"same options, first result returned",
&CountOptions{
Epsilon: ln3,
},
&CountOptions{
Epsilon: ln3,
},
true,
false,
true},
{"same options, second result returned",
&CountOptions{
Epsilon: ln3,
},
&CountOptions{
Epsilon: ln3,
},
false,
true,
true},
{"different epsilon",
&CountOptions{
Epsilon: ln3,
},
&CountOptions{
Epsilon: 2,
},
false,
false,
true},
{"different delta",
&CountOptions{
Epsilon: ln3,
Delta: tenten,
Noise: noise.Gaussian(),
},
&CountOptions{
Epsilon: ln3,
Delta: tenfive,
Noise: noise.Gaussian(),
},
false,
false,
true},
{"different MaxPartitionsContributed",
&CountOptions{
Epsilon: ln3,
MaxPartitionsContributed: 1,
},
&CountOptions{
Epsilon: ln3,
MaxPartitionsContributed: 2,
},
false,
false,
true},
{"different maxContributionsPerPartition",
&CountOptions{
Epsilon: ln3,
maxContributionsPerPartition: 2,
},
&CountOptions{
Epsilon: ln3,
maxContributionsPerPartition: 5,
},
false,
false,
true},
{"different noise",
&CountOptions{
Epsilon: ln3,
Delta: tenten,
Noise: noise.Gaussian(),
},
&CountOptions{
Epsilon: ln3,
Noise: noise.Laplace(),
},
false,
false,
true},
} {
c1 := NewCount(tc.opt1)
c2 := NewCount(tc.opt2)
if tc.returnResult1 {
c1.Result()
}
if tc.returnResult2 {
c2.Result()
}
if err := checkMergeCount(c1, c2); (err != nil) != tc.wantErr {
t.Errorf("CheckMerge: when %v for err got %v, want %t", tc.desc, err, tc.wantErr)
}
}
} | explode_data.jsonl/57750 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 1444
} | [
2830,
3393,
2507,
3973,
52096,
1155,
353,
8840,
836,
8,
341,
2023,
8358,
17130,
1669,
2088,
3056,
1235,
341,
197,
41653,
688,
914,
198,
197,
64838,
16,
688,
353,
2507,
3798,
198,
197,
64838,
17,
688,
353,
2507,
3798,
198,
197,
853,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestEnvAddOnKubeflow(t *testing.T) {
cfg := NewDefault()
defer func() {
os.RemoveAll(cfg.ConfigPath)
os.RemoveAll(cfg.KubectlCommandsOutputPath)
os.RemoveAll(cfg.RemoteAccessCommandsOutputPath)
}()
os.Setenv("AWS_K8S_TESTER_EKS_ADD_ON_MANAGED_NODE_GROUPS_ENABLE", `true`)
defer os.Unsetenv("AWS_K8S_TESTER_EKS_ADD_ON_MANAGED_NODE_GROUPS_ENABLE")
os.Setenv("AWS_K8S_TESTER_EKS_ADD_ON_KUBEFLOW_ENABLE", "true")
defer os.Unsetenv("AWS_K8S_TESTER_EKS_ADD_ON_KUBEFLOW_ENABLE")
os.Setenv("AWS_K8S_TESTER_EKS_ADD_ON_KUBEFLOW_NAMESPACE", "kubeflow")
defer os.Unsetenv("AWS_K8S_TESTER_EKS_ADD_ON_KUBEFLOW_NAMESPACE")
os.Setenv("AWS_K8S_TESTER_EKS_ADD_ON_KUBEFLOW_KFCTL_DOWNLOAD_URL", "kubeflow-download-here")
defer os.Unsetenv("AWS_K8S_TESTER_EKS_ADD_ON_KUBEFLOW_KFCTL_DOWNLOAD_URL")
os.Setenv("AWS_K8S_TESTER_EKS_ADD_ON_KUBEFLOW_BASE_DIR", "kubeflow-base-dir")
defer os.Unsetenv("AWS_K8S_TESTER_EKS_ADD_ON_KUBEFLOW_BASE_DIR")
if err := cfg.UpdateFromEnvs(); err != nil {
t.Fatal(err)
}
err := cfg.ValidateAndSetDefaults()
assert.NoError(t, err)
if !cfg.AddOnKubeflow.Enable {
t.Fatalf("unexpected cfg.AddOnKubeflow.Enable %v", cfg.AddOnKubeflow.Enable)
}
if cfg.AddOnKubeflow.KfctlDownloadURL != "kubeflow-download-here" {
t.Fatalf("unexpected cfg.AddOnKubeflow.KfctlDownloadURL %q", cfg.AddOnKubeflow.KfctlDownloadURL)
}
if cfg.AddOnKubeflow.BaseDir != "kubeflow-base-dir" {
t.Fatalf("unexpected cfg.AddOnKubeflow.BaseDir %q", cfg.AddOnKubeflow.BaseDir)
}
} | explode_data.jsonl/69907 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 761
} | [
2830,
3393,
14359,
2212,
1925,
42,
392,
823,
10303,
1155,
353,
8840,
836,
8,
341,
50286,
1669,
1532,
3675,
741,
16867,
2915,
368,
341,
197,
25078,
84427,
28272,
10753,
1820,
340,
197,
25078,
84427,
28272,
11352,
53380,
30479,
5097,
1820,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestDecodeYAMLEmptyString(t *testing.T) {
f := newFixture(t)
defer f.TearDown()
tf := `
observed = decode_yaml('')
expected = None
load('assert.tilt', 'assert')
assert.equals(expected, observed)
`
f.File("Tiltfile", tf)
_, err := f.ExecFile("Tiltfile")
if err != nil {
fmt.Println(f.PrintOutput())
}
require.NoError(t, err)
} | explode_data.jsonl/10612 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 146
} | [
2830,
3393,
32564,
56,
1402,
867,
76,
1595,
703,
1155,
353,
8840,
836,
8,
341,
1166,
1669,
501,
18930,
1155,
340,
16867,
282,
836,
682,
4454,
2822,
3244,
69,
1669,
22074,
5481,
2771,
284,
16895,
64380,
37365,
7325,
284,
2240,
271,
107... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestMarshalNS(t *testing.T) {
dst := Tables{"hello", "world"}
data, err := Marshal(&dst)
if err != nil {
t.Fatalf("Marshal: %v", err)
}
want := `<Tables><table xmlns="http://www.w3.org/TR/html4/">hello</table><table xmlns="http://www.w3schools.com/furniture">world</table></Tables>`
str := string(data)
if str != want {
t.Errorf("have: %q\nwant: %q\n", str, want)
}
} | explode_data.jsonl/25295 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 166
} | [
2830,
3393,
55438,
2448,
1155,
353,
8840,
836,
8,
341,
52051,
1669,
42152,
4913,
14990,
497,
330,
14615,
16707,
8924,
11,
1848,
1669,
35667,
2099,
15658,
340,
743,
1848,
961,
2092,
341,
197,
3244,
30762,
445,
55438,
25,
1018,
85,
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... | 3 |
func TestNestedMapPin(t *testing.T) {
m, err := NewMap(&MapSpec{
Type: ArrayOfMaps,
KeySize: 4,
ValueSize: 4,
MaxEntries: 2,
InnerMap: &MapSpec{
Type: Array,
KeySize: 4,
ValueSize: 4,
MaxEntries: 1,
},
})
testutils.SkipIfNotSupported(t, err)
if err != nil {
t.Fatal(err)
}
defer m.Close()
tmp, err := ioutil.TempDir("/sys/fs/bpf", "ebpf-test")
if err != nil {
t.Fatal(err)
}
defer os.RemoveAll(tmp)
path := filepath.Join(tmp, "nested")
if err := m.Pin(path); err != nil {
t.Fatal(err)
}
m.Close()
m, err = LoadPinnedMap(path, nil)
if err != nil {
t.Fatal(err)
}
defer m.Close()
} | explode_data.jsonl/21650 | {
"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,
71986,
2227,
19861,
1155,
353,
8840,
836,
8,
341,
2109,
11,
1848,
1669,
1532,
2227,
2099,
2227,
8327,
515,
197,
27725,
25,
981,
2910,
2124,
36562,
345,
197,
55242,
1695,
25,
262,
220,
19,
345,
197,
47399,
1695,
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... | 5 |
func TestUpdateUserToken(t *testing.T) {
dir, err := ioutil.TempDir("", "commitlog-index")
assert.NoError(t, err)
fd := NewFileDB("test", 1024*1024, 256)
defer func() {
fd.Close()
os.Remove(dir)
}()
uid := "uid1234"
token := "token12345"
err = fd.UpdateUserToken(uid, lmproto.APP, lmproto.DeviceLevelMaster, token)
assert.NoError(t, err)
acttoken, level, err := fd.GetUserToken(uid, lmproto.APP)
assert.NoError(t, err)
assert.Equal(t, token, acttoken)
assert.Equal(t, lmproto.DeviceLevelMaster, level)
} | explode_data.jsonl/64027 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 220
} | [
2830,
3393,
4289,
1474,
3323,
1155,
353,
8840,
836,
8,
341,
48532,
11,
1848,
1669,
43144,
65009,
6184,
19814,
330,
17413,
839,
21492,
1138,
6948,
35699,
1155,
11,
1848,
340,
61721,
1669,
1532,
1703,
3506,
445,
1944,
497,
220,
16,
15,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestWordCountWithMainEnglishWithCJKRunes(t *testing.T) {
t.Parallel()
settings := map[string]interface{}{"hasCJKLanguage": true}
assertFunc := func(t *testing.T, ext string, pages page.Pages) {
p := pages[0]
if p.WordCount() != 74 {
t.Fatalf("[%s] incorrect word count, expected %v, got %v", ext, 74, p.WordCount())
}
if p.Summary() != simplePageWithMainEnglishWithCJKRunesSummary {
t.Fatalf("[%s] incorrect Summary for content '%s'. expected %v, got %v", ext, p.Plain(),
simplePageWithMainEnglishWithCJKRunesSummary, p.Summary())
}
}
testAllMarkdownEnginesForPages(t, assertFunc, settings, simplePageWithMainEnglishWithCJKRunes)
} | explode_data.jsonl/60624 | {
"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,
10879,
2507,
2354,
6202,
22574,
2354,
89349,
6727,
288,
1155,
353,
8840,
836,
8,
341,
3244,
41288,
7957,
741,
62930,
1669,
2415,
14032,
31344,
6257,
4913,
4648,
89349,
13806,
788,
830,
630,
6948,
9626,
1669,
2915,
1155,
353,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
func TestApplicationNode(t *testing.T) {
app := testNode()
err := app.Run(NewTestEngine())
assert.Equal(t, nil, err)
info := app.Node()
assert.Equal(t, int64(0), info.Metrics["num_clients"])
assert.NotEqual(t, 0, info.Started)
} | explode_data.jsonl/53959 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 96
} | [
2830,
3393,
4988,
1955,
1155,
353,
8840,
836,
8,
341,
28236,
1669,
1273,
1955,
741,
9859,
1669,
906,
16708,
35063,
2271,
4571,
2398,
6948,
12808,
1155,
11,
2092,
11,
1848,
340,
27043,
1669,
906,
21714,
741,
6948,
12808,
1155,
11,
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 TestCloudTasksGetQueueError(t *testing.T) {
errCode := codes.PermissionDenied
mockCloudTasks.err = gstatus.Error(errCode, "test error")
var formattedName string = fmt.Sprintf("projects/%s/locations/%s/queues/%s", "[PROJECT]", "[LOCATION]", "[QUEUE]")
var request = &taskspb.GetQueueRequest{
Name: formattedName,
}
c, err := NewClient(context.Background(), clientOpt)
if err != nil {
t.Fatal(err)
}
resp, err := c.GetQueue(context.Background(), request)
if st, ok := gstatus.FromError(err); !ok {
t.Errorf("got error %v, expected grpc error", err)
} else if c := st.Code(); c != errCode {
t.Errorf("got error code %q, want %q", c, errCode)
}
_ = resp
} | explode_data.jsonl/30842 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 259
} | [
2830,
3393,
16055,
25449,
1949,
7554,
1454,
1155,
353,
8840,
836,
8,
341,
9859,
2078,
1669,
13912,
73409,
54481,
198,
77333,
16055,
25449,
18441,
284,
342,
2829,
6141,
3964,
2078,
11,
330,
1944,
1465,
5130,
2405,
23126,
675,
914,
284,
8... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 4 |
func TestParse_DefaultNameParsing(t *testing.T) {
s := NewTestStatsd()
validLines := []string{
"valid:1|c",
"valid.foo-bar:11|c",
}
for _, line := range validLines {
err := s.parseStatsdLine(line)
if err != nil {
t.Errorf("Parsing line %s should not have resulted in an error\n", line)
}
}
validations := []struct {
name string
value int64
}{
{
"valid",
1,
},
{
"valid_foo-bar",
11,
},
}
for _, test := range validations {
err := testValidateCounter(test.name, test.value, s.counters)
if err != nil {
t.Error(err.Error())
}
}
} | explode_data.jsonl/14370 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 266
} | [
2830,
3393,
14463,
60336,
675,
68839,
1155,
353,
8840,
836,
8,
341,
1903,
1669,
1532,
2271,
16635,
67,
741,
56322,
16794,
1669,
3056,
917,
515,
197,
197,
1,
1891,
25,
16,
91,
66,
756,
197,
197,
1,
1891,
58432,
15773,
25,
16,
16,
9... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestBuzzerDriverSetName(t *testing.T) {
g := initTestBuzzerDriver(newGpioTestAdaptor())
g.SetName("mybot")
gobottest.Assert(t, g.Name(), "mybot")
} | explode_data.jsonl/5905 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 63
} | [
2830,
3393,
33,
91447,
11349,
69778,
1155,
353,
8840,
836,
8,
341,
3174,
1669,
2930,
2271,
33,
91447,
11349,
1755,
38,
11917,
2271,
2589,
32657,
2398,
3174,
4202,
675,
445,
2408,
6331,
1138,
3174,
674,
1716,
477,
11711,
1155,
11,
342,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestCreateNamespace(t *testing.T) {
api, router, mockCtl := initNamespaceAPI(t)
defer mockCtl.Finish()
mkNamespaceService := ms.NewMockNamespaceService(mockCtl)
api.NS = mkNamespaceService
mLicense := ms.NewMockLicenseService(mockCtl)
api.License = mLicense
nsa := getMockNS("testA")
quotas := map[string]int{"maxNodeCount": 10}
mLicense.EXPECT().GetDefaultQuotas(nsa.Name).Return(quotas, nil)
mLicense.EXPECT().CreateQuota(nsa.Name, quotas).Return(nil)
mkNamespaceService.EXPECT().Create(nsa).Return(nsa, nil)
// 200
req, _ := http.NewRequest(http.MethodPost, "/testA/namespace", nil)
w := httptest.NewRecorder()
router.ServeHTTP(w, req)
assert.Equal(t, http.StatusOK, w.Code)
err := fmt.Errorf("error")
mkNamespaceService.EXPECT().Create(nsa).Return(nil, err)
// 500
req, _ = http.NewRequest(http.MethodPost, "/testA/namespace", nil)
w = httptest.NewRecorder()
router.ServeHTTP(w, req)
assert.Equal(t, http.StatusInternalServerError, w.Code)
mkNamespaceService.EXPECT().Create(nsa).Return(nsa, nil)
mLicense.EXPECT().GetDefaultQuotas(nsa.Name).Return(quotas, nil)
mLicense.EXPECT().CreateQuota(nsa.Name, quotas).Return(err)
// 200
req, _ = http.NewRequest(http.MethodPost, "/testA/namespace", nil)
w = httptest.NewRecorder()
router.ServeHTTP(w, req)
assert.Equal(t, http.StatusOK, w.Code)
} | explode_data.jsonl/54051 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 524
} | [
2830,
3393,
4021,
22699,
1155,
353,
8840,
836,
8,
341,
54299,
11,
9273,
11,
7860,
94252,
1669,
2930,
22699,
7082,
1155,
340,
16867,
7860,
94252,
991,
18176,
741,
2109,
74,
22699,
1860,
1669,
9829,
7121,
11571,
22699,
1860,
30389,
94252,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestWSSetOriginOptions(t *testing.T) {
o := testWSOptions()
for _, test := range []struct {
content string
err string
}{
{"@@@://host.com/", "invalid URI"},
{"http://this:is:bad:url/", "invalid port"},
} {
t.Run(test.err, func(t *testing.T) {
o.Websocket.AllowedOrigins = []string{test.content}
s := &Server{}
l := &captureErrorLogger{errCh: make(chan string, 1)}
s.SetLogger(l, false, false)
s.wsSetOriginOptions(&o.Websocket)
select {
case e := <-l.errCh:
if !strings.Contains(e, test.err) {
t.Fatalf("Unexpected error: %v", e)
}
case <-time.After(50 * time.Millisecond):
t.Fatalf("Did not get the error")
}
})
}
} | explode_data.jsonl/42711 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 313
} | [
2830,
3393,
54,
1220,
295,
13298,
3798,
1155,
353,
8840,
836,
8,
341,
22229,
1669,
1273,
7433,
3798,
741,
2023,
8358,
1273,
1669,
2088,
3056,
1235,
341,
197,
27751,
914,
198,
197,
9859,
257,
914,
198,
197,
59403,
197,
197,
4913,
19191... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestRevSquash(t *testing.T) {
assert(t, revSquash(` {}`) == `{}`)
assert(t, revSquash(` }`) == ` }`)
assert(t, revSquash(` [123]`) == `[123]`)
assert(t, revSquash(` ,123,123]`) == ` ,123,123]`)
assert(t, revSquash(` hello,[[true,false],[0,1,2,3,5],[123]]`) == `[[true,false],[0,1,2,3,5],[123]]`)
assert(t, revSquash(` "hello"`) == `"hello"`)
assert(t, revSquash(` "hel\\lo"`) == `"hel\\lo"`)
assert(t, revSquash(` "hel\\"lo"`) == `"lo"`)
assert(t, revSquash(` "hel\\\"lo"`) == `"hel\\\"lo"`)
assert(t, revSquash(`hel\\\"lo"`) == `hel\\\"lo"`)
assert(t, revSquash(`\"hel\\\"lo"`) == `\"hel\\\"lo"`)
assert(t, revSquash(`\\\"hel\\\"lo"`) == `\\\"hel\\\"lo"`)
assert(t, revSquash(`\\\\"hel\\\"lo"`) == `"hel\\\"lo"`)
assert(t, revSquash(`hello"`) == `hello"`)
jsonStr := `true,[0,1,"sadf\"asdf",{"hi":["hello","t\"\"u",{"a":"b"}]},9]`
assert(t, revSquash(jsonStr) == jsonStr[5:])
assert(t, revSquash(jsonStr[:len(jsonStr)-3]) == `{"hi":["hello","t\"\"u",{"a":"b"}]}`)
assert(t, revSquash(jsonStr[:len(jsonStr)-4]) == `["hello","t\"\"u",{"a":"b"}]`)
assert(t, revSquash(jsonStr[:len(jsonStr)-5]) == `{"a":"b"}`)
assert(t, revSquash(jsonStr[:len(jsonStr)-6]) == `"b"`)
assert(t, revSquash(jsonStr[:len(jsonStr)-10]) == `"a"`)
assert(t, revSquash(jsonStr[:len(jsonStr)-15]) == `"t\"\"u"`)
assert(t, revSquash(jsonStr[:len(jsonStr)-24]) == `"hello"`)
assert(t, revSquash(jsonStr[:len(jsonStr)-33]) == `"hi"`)
assert(t, revSquash(jsonStr[:len(jsonStr)-39]) == `"sadf\"asdf"`)
} | explode_data.jsonl/43494 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 745
} | [
2830,
3393,
36184,
50,
446,
988,
1155,
353,
8840,
836,
8,
341,
6948,
1155,
11,
5772,
50,
446,
988,
5809,
4687,
32881,
621,
53692,
27085,
6948,
1155,
11,
5772,
50,
446,
988,
5809,
335,
32881,
621,
1565,
335,
24183,
6948,
1155,
11,
57... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestBigItems(t *testing.T) {
var key [256]string
for i := 0; i < 256; i++ {
key[i] = "foo"
}
m := make(map[[256]string][256]string, 4)
for i := 0; i < 100; i++ {
key[37] = fmt.Sprintf("string%02d", i)
m[key] = key
}
var keys [100]string
var values [100]string
i := 0
for k, v := range m {
keys[i] = k[37]
values[i] = v[37]
i++
}
sort.Strings(keys[:])
sort.Strings(values[:])
for i := 0; i < 100; i++ {
if keys[i] != fmt.Sprintf("string%02d", i) {
t.Errorf("#%d: missing key: %v", i, keys[i])
}
if values[i] != fmt.Sprintf("string%02d", i) {
t.Errorf("#%d: missing value: %v", i, values[i])
}
}
} | explode_data.jsonl/19913 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 318
} | [
2830,
3393,
15636,
4353,
1155,
353,
8840,
836,
8,
341,
2405,
1376,
508,
17,
20,
21,
30953,
198,
2023,
600,
1669,
220,
15,
26,
600,
366,
220,
17,
20,
21,
26,
600,
1027,
341,
197,
23634,
989,
60,
284,
330,
7975,
698,
197,
532,
210... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestTaggingSuiteJaeger(t *testing.T) {
mockTracer := mocktracer.New()
mockTracer.RegisterInjector(opentracing.HTTPHeaders, jaegerFormatInjector{})
mockTracer.RegisterExtractor(opentracing.HTTPHeaders, jaegerFormatExtractor{})
opts := []grpc_opentracing.Option{
grpc_opentracing.WithTracer(mockTracer),
}
s := &OpentracingSuite{
mockTracer: mockTracer,
InterceptorTestSuite: makeInterceptorTestSuite(t, opts),
}
suite.Run(t, s)
} | explode_data.jsonl/70879 | {
"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,
5668,
3173,
28000,
52445,
1878,
1155,
353,
8840,
836,
8,
341,
77333,
1282,
9584,
1669,
7860,
94941,
7121,
741,
77333,
1282,
9584,
19983,
61836,
17096,
23745,
4527,
27358,
10574,
11,
11937,
1878,
4061,
61836,
37790,
77333,
1282,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestAddHTLCNegativeBalance(t *testing.T) {
t.Parallel()
// We'll kick off the test by creating our channels which both are
// loaded with 5 BTC each.
aliceChannel, _, cleanUp, err := createTestChannels(1)
if err != nil {
t.Fatalf("unable to create test channels: %v", err)
}
defer cleanUp()
// First, we'll add 5 HTLCs of 1 BTC each to Alice's commitment.
const numHTLCs = 4
htlcAmt := lnwire.NewMSatFromSatoshis(btcutil.SatoshiPerBitcoin)
for i := 0; i < numHTLCs; i++ {
htlc, _ := createHTLC(i, htlcAmt)
if _, err := aliceChannel.AddHTLC(htlc); err != nil {
t.Fatalf("unable to add htlc: %v", err)
}
}
// We'll then craft another HTLC with 2 BTC to add to Alice's channel.
// This attempt should put Alice in the negative, meaning she should
// reject the HTLC.
htlc, _ := createHTLC(numHTLCs+1, htlcAmt*2)
_, err = aliceChannel.AddHTLC(htlc)
if err != ErrInsufficientBalance {
t.Fatalf("expected insufficient balance, instead got: %v", err)
}
} | explode_data.jsonl/28266 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 373
} | [
2830,
3393,
2212,
2545,
8556,
38489,
21190,
1155,
353,
8840,
836,
8,
341,
3244,
41288,
7957,
2822,
197,
322,
1205,
3278,
10323,
1007,
279,
1273,
553,
6825,
1039,
11744,
892,
2176,
525,
198,
197,
322,
6661,
448,
220,
20,
36045,
1817,
6... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 5 |
func TestStrArray_SetArray(t *testing.T) {
gtest.C(t, func(t *gtest.T) {
a1 := []string{"0", "1", "2", "3", "4", "5", "6"}
a2 := []string{"a", "b", "c", "d"}
array1 := garray.NewStrArrayFrom(a1)
t.Assert(array1.Contains("2"), true)
t.Assert(array1.Len(), 7)
array1 = array1.SetArray(a2)
t.Assert(array1.Contains("2"), false)
t.Assert(array1.Contains("c"), true)
t.Assert(array1.Len(), 4)
})
} | explode_data.jsonl/53103 | {
"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,
2580,
1857,
14812,
1857,
1155,
353,
8840,
836,
8,
341,
3174,
1944,
727,
1155,
11,
2915,
1155,
353,
82038,
836,
8,
341,
197,
11323,
16,
1669,
3056,
917,
4913,
15,
497,
330,
16,
497,
330,
17,
497,
330,
18,
497,
330,
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 TestRepository_GetCommit_Error(t *testing.T) {
githubErr := errors.New("github error")
mocksGitService := new(mocks.GitService)
mocksGitService.On("GetCommit", Anything, AnythingOfType("string"), AnythingOfType("string"), AnythingOfType("string")).
Return(nil, nil, githubErr)
repository := initRepository(t)
if repository != nil {
repository.gitService = mocksGitService
_, err := repository.GetCommit("test", "test", "sha")
assert.Error(t, err)
assert.Contains(t, err.Error(), "github error")
mocksGitService.AssertNumberOfCalls(t, "GetCommit", 1)
mocksGitService.AssertExpectations(t)
}
} | explode_data.jsonl/36438 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 227
} | [
2830,
3393,
4624,
13614,
33441,
28651,
1155,
353,
8840,
836,
8,
341,
3174,
3827,
7747,
1669,
5975,
7121,
445,
5204,
1465,
5130,
2109,
25183,
46562,
1860,
1669,
501,
1255,
25183,
1224,
275,
1860,
340,
2109,
25183,
46562,
1860,
8071,
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... | 2 |
func TestAskAboutArgoCredentialsFromLBWithoutError(t *testing.T) {
GetArgoServerSvcFunc = func() (service core.Service, e error) {
return core.Service{
TypeMeta: v1.TypeMeta{},
ObjectMeta: v1.ObjectMeta{},
Spec: core.ServiceSpec{
Type: "LoadBalancer",
},
Status: core.ServiceStatus{},
}, nil
}
installCmdOptions := &entity.InstallCmdOptions{
Argo: struct {
Host string
Username string
Password string
Token string
Update bool
}{Username: "test", Password: "test", Token: "test", Update: false},
}
q := &ArgoQuestionnaire{prompt: &MockPrompt{}}
err := q.AskAboutArgoCredentials(installCmdOptions, &MockKube{})
if err != nil || installCmdOptions.Argo.Host != "https://localhost" {
t.Errorf("Argo host should be \"https://localhost\", but %s", installCmdOptions.Argo.Host)
}
} | explode_data.jsonl/28202 | {
"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,
26172,
10494,
2735,
78,
27025,
3830,
34068,
26040,
1454,
1155,
353,
8840,
836,
8,
341,
37654,
2735,
78,
5475,
92766,
9626,
284,
2915,
368,
320,
7936,
6200,
13860,
11,
384,
1465,
8,
341,
197,
853,
6200,
13860,
515,
298,
277... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestTypes(t *testing.T) {
state := lua.NewState()
defer state.Close()
std.Open(state)
err := state.ExecFrom(bytes.NewReader([]byte(`
tbl = {
["Nil"] = nil,
["Bool"] = true,
["String"] = "string",
["Number_value"] = 10,
["Func"] = function() end
}
`)))
if err != nil {
t.Error(err)
}
var stct testStruct
state.GetGlobal("tbl")
v := state.Pop()
if err := NewMapper(Option{NameFunc: Id}).Map(v, &stct); err != nil {
t.Error(err)
}
errorIfNotEqual(t, nil, stct.Nil)
errorIfNotEqual(t, true, stct.Bool)
errorIfNotEqual(t, "string", stct.String)
errorIfNotEqual(t, 10, stct.Number)
} | explode_data.jsonl/79577 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 336
} | [
2830,
3393,
4173,
1155,
353,
8840,
836,
8,
341,
24291,
1669,
20357,
7121,
1397,
741,
16867,
1584,
10421,
741,
6736,
12953,
8390,
692,
9859,
1669,
1584,
30798,
3830,
23158,
68587,
10556,
3782,
61528,
286,
21173,
284,
341,
310,
4383,
19064,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestCheckForCFHeadersMismatch(t *testing.T) {
for _, testCase := range checkCFHTestCases {
t.Run(testCase.name, func(t *testing.T) {
mismatch := checkForCFHeaderMismatch(
testCase.headers, testCase.idx,
)
if mismatch != testCase.mismatch {
t.Fatalf("Wrong mismatch detected. Expected: "+
"%t, got: %t", testCase.mismatch,
mismatch)
}
})
}
} | explode_data.jsonl/4696 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 171
} | [
2830,
3393,
3973,
2461,
9650,
10574,
82572,
1155,
353,
8840,
836,
8,
1476,
2023,
8358,
54452,
1669,
2088,
1779,
9650,
39,
2271,
37302,
341,
197,
3244,
16708,
8623,
4207,
2644,
11,
2915,
1155,
353,
8840,
836,
8,
341,
298,
2109,
24976,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestMergeChangesets(t *testing.T) {
if testing.Short() {
t.Skip()
}
ctx := context.Background()
db := dbtest.NewDB(t, "")
cstore := store.New(db, nil)
userID := ct.CreateTestUser(t, db, true).ID
batchSpec := ct.CreateBatchSpec(t, ctx, cstore, "test-merge", userID)
otherBatchSpec := ct.CreateBatchSpec(t, ctx, cstore, "test-merge-other", userID)
batchChange := ct.CreateBatchChange(t, ctx, cstore, "test-merge", userID, batchSpec.ID)
otherBatchChange := ct.CreateBatchChange(t, ctx, cstore, "test-merge-other", userID, otherBatchSpec.ID)
repos, _ := ct.CreateTestRepos(t, context.Background(), db, 1)
repo := repos[0]
changeset := ct.CreateChangeset(t, ctx, cstore, ct.TestChangesetOpts{
Repo: repo.ID,
BatchChange: batchChange.ID,
PublicationState: btypes.ChangesetPublicationStatePublished,
ReconcilerState: btypes.ReconcilerStateCompleted,
ExternalState: btypes.ChangesetExternalStateOpen,
})
otherChangeset := ct.CreateChangeset(t, ctx, cstore, ct.TestChangesetOpts{
Repo: repo.ID,
BatchChange: otherBatchChange.ID,
PublicationState: btypes.ChangesetPublicationStatePublished,
ReconcilerState: btypes.ReconcilerStateCompleted,
ExternalState: btypes.ChangesetExternalStateOpen,
})
mergedChangeset := ct.CreateChangeset(t, ctx, cstore, ct.TestChangesetOpts{
Repo: repo.ID,
BatchChange: otherBatchChange.ID,
PublicationState: btypes.ChangesetPublicationStatePublished,
ReconcilerState: btypes.ReconcilerStateCompleted,
ExternalState: btypes.ChangesetExternalStateMerged,
})
r := &Resolver{store: cstore}
s, err := graphqlbackend.NewSchema(db, r, nil, nil, nil, nil, nil, nil)
if err != nil {
t.Fatal(err)
}
generateInput := func() map[string]interface{} {
return map[string]interface{}{
"batchChange": marshalBatchChangeID(batchChange.ID),
"changesets": []string{string(marshalChangesetID(changeset.ID))},
}
}
var response struct {
MergeChangesets apitest.BulkOperation
}
actorCtx := actor.WithActor(ctx, actor.FromUser(userID))
t.Run("0 changesets fails", func(t *testing.T) {
input := generateInput()
input["changesets"] = []string{}
errs := apitest.Exec(actorCtx, t, s, input, &response, mutationMergeChangesets)
if len(errs) != 1 {
t.Fatalf("expected single errors, but got none")
}
if have, want := errs[0].Message, "specify at least one changeset"; have != want {
t.Fatalf("wrong error. want=%q, have=%q", want, have)
}
})
t.Run("changeset in different batch change fails", func(t *testing.T) {
input := generateInput()
input["changesets"] = []string{string(marshalChangesetID(otherChangeset.ID))}
errs := apitest.Exec(actorCtx, t, s, input, &response, mutationMergeChangesets)
if len(errs) != 1 {
t.Fatalf("expected single errors, but got none")
}
if have, want := errs[0].Message, "some changesets could not be found"; have != want {
t.Fatalf("wrong error. want=%q, have=%q", want, have)
}
})
t.Run("merged changeset fails", func(t *testing.T) {
input := generateInput()
input["changesets"] = []string{string(marshalChangesetID(mergedChangeset.ID))}
errs := apitest.Exec(actorCtx, t, s, input, &response, mutationMergeChangesets)
if len(errs) != 1 {
t.Fatalf("expected single errors, but got none")
}
if have, want := errs[0].Message, "some changesets could not be found"; have != want {
t.Fatalf("wrong error. want=%q, have=%q", want, have)
}
})
t.Run("runs successfully", func(t *testing.T) {
input := generateInput()
apitest.MustExec(actorCtx, t, s, input, &response, mutationMergeChangesets)
if response.MergeChangesets.ID == "" {
t.Fatalf("expected bulk operation to be created, but was not")
}
})
} | explode_data.jsonl/53221 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 1468
} | [
2830,
3393,
52096,
11317,
1415,
1155,
353,
8840,
836,
8,
341,
743,
7497,
55958,
368,
341,
197,
3244,
57776,
741,
197,
630,
20985,
1669,
2266,
19047,
741,
20939,
1669,
2927,
1944,
7121,
3506,
1155,
11,
14676,
1444,
4314,
1669,
3553,
7121... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestEqualsOrContainsPathAbs(t *testing.T) {
testEqualsOrContainsPathAbs(t, true, "/a.proto", "/a.proto")
testEqualsOrContainsPathAbs(t, true, "/", "/a.proto")
testEqualsOrContainsPathAbs(t, false, "a.proto", "/")
testEqualsOrContainsPathAbs(t, true, "/", "/a/b.proto")
testEqualsOrContainsPathAbs(t, true, "/", "/a/b")
testEqualsOrContainsPathAbs(t, false, "/a", "/ab/c")
testEqualsOrContainsPathAbs(t, true, "/a", "/a/b/c")
testEqualsOrContainsPathAbs(t, false, "/b", "/a/b/c")
testEqualsOrContainsPathAbs(t, true, "/b", "/b/b/c")
testEqualsOrContainsPathAbs(t, true, "/b", "/b/a/c")
} | explode_data.jsonl/11911 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 262
} | [
2830,
3393,
4315,
2195,
23805,
1820,
27778,
1155,
353,
8840,
836,
8,
341,
18185,
4315,
2195,
23805,
1820,
27778,
1155,
11,
830,
11,
3521,
64,
57322,
497,
3521,
64,
57322,
1138,
18185,
4315,
2195,
23805,
1820,
27778,
1155,
11,
830,
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 TestIngessToPrometheus_IngressMetric(t *testing.T) {
framework.
NewTest(t).
Run(func(ctx framework.TestContext) {
ctx.NewSubTest("SetupAndPrometheus").
Run(func(ctx framework.TestContext) {
label := "destination_service"
labelValue := "productpage.{{.TestNamespace}}.svc.cluster.local"
testMetric(t, ctx, label, labelValue)
})
})
} | explode_data.jsonl/49346 | {
"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,
25416,
433,
1249,
35186,
39705,
25972,
2483,
54310,
1155,
353,
8840,
836,
8,
341,
1166,
5794,
624,
197,
197,
3564,
2271,
1155,
4292,
197,
85952,
18552,
7502,
12626,
8787,
1972,
8,
341,
298,
20985,
7121,
3136,
2271,
445,
2182... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestAltKeyring_KeyByAddress(t *testing.T) {
keyring, err := New(t.Name(), BackendTest, t.TempDir(), nil)
require.NoError(t, err)
uid := someKey
mnemonic, _, err := keyring.NewMnemonic(uid, English, sdk.FullFundraiserPath, hd.Secp256k1)
require.NoError(t, err)
key, err := keyring.KeyByAddress(mnemonic.GetAddress())
require.NoError(t, err)
requireEqualInfo(t, key, mnemonic)
} | explode_data.jsonl/73455 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 155
} | [
2830,
3393,
26017,
1592,
12640,
35253,
1359,
4286,
1155,
353,
8840,
836,
8,
341,
23634,
12640,
11,
1848,
1669,
1532,
1155,
2967,
1507,
55260,
2271,
11,
259,
65009,
6184,
1507,
2092,
340,
17957,
35699,
1155,
11,
1848,
692,
197,
2423,
166... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestMultiError(t *testing.T) {
m := MultiError{}
m.Collect(errors.New("Error 1"))
m.Collect(errors.New("Error 2"))
err := m.ToError()
expected := `Error 1
Error 2`
if err.Error() != expected {
t.Fatalf("%s != %s", err.Error(), expected)
}
m = MultiError{}
if err := m.ToError(); err != nil {
t.Fatalf("Unexpected error: %v", err)
}
} | explode_data.jsonl/30071 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 143
} | [
2830,
3393,
20358,
1454,
1155,
353,
8840,
836,
8,
341,
2109,
1669,
17439,
1454,
31483,
2109,
727,
24605,
38881,
7121,
445,
1454,
220,
16,
5455,
2109,
727,
24605,
38881,
7121,
445,
1454,
220,
17,
28075,
9859,
1669,
296,
3274,
1454,
741,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestIncrementalFullClusterBackup(t *testing.T) {
defer leaktest.AfterTest(t)()
const numAccounts = 10
const incrementalBackupLocation = "nodelocal://0/inc-full-backup"
_, _, sqlDB, tempDir, cleanupFn := backupRestoreTestSetup(t, singleNode, numAccounts, initNone)
_, _, sqlDBRestore, cleanupEmptyCluster := backupRestoreTestSetupEmpty(t, singleNode, tempDir, initNone)
defer cleanupFn()
defer cleanupEmptyCluster()
sqlDB.Exec(t, `BACKUP TO $1`, localFoo)
sqlDB.Exec(t, fmt.Sprintf("CREATE USER maxroach1"))
sqlDB.Exec(t, `BACKUP TO $1 INCREMENTAL FROM $2`, incrementalBackupLocation, localFoo)
sqlDBRestore.Exec(t, `RESTORE FROM $1, $2`, localFoo, incrementalBackupLocation)
checkQuery := "SELECT * FROM system.users"
sqlDBRestore.CheckQueryResults(t, checkQuery, sqlDB.QueryStr(t, checkQuery))
} | explode_data.jsonl/48477 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 293
} | [
2830,
3393,
38311,
278,
9432,
28678,
56245,
1155,
353,
8840,
836,
8,
341,
16867,
23352,
1944,
36892,
2271,
1155,
8,
2822,
4777,
1629,
41369,
284,
220,
16,
15,
198,
4777,
52299,
56245,
4707,
284,
330,
77,
720,
3683,
1110,
15,
72388,
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 TestLogsWorkflowOpts_Validate_StartError(t *testing.T) {
opts := logsWorkflowOpts{logsWorkflowVars: logsWorkflowVars{logsSharedVars: logsSharedVars{startString: "abc"}}}
err := opts.Validate()
assert.Equal(t, fmt.Errorf("Could not find format for \"abc\""), err)
} | explode_data.jsonl/74227 | {
"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,
51053,
62768,
43451,
62,
17926,
38056,
1454,
1155,
353,
8840,
836,
8,
341,
64734,
1669,
18422,
62768,
43451,
90,
22081,
62768,
28305,
25,
18422,
62768,
28305,
90,
22081,
16997,
28305,
25,
18422,
16997,
28305,
90,
2468,
703,
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 TestRandomAddress(t *testing.T) {
fmt.Println("TestRandomAddress")
addr := &Address{
StateProvince: "CO",
}
office := findOfficeByState(addr.StateProvince)
assert.NotNil(t, office, "office in CO should not be nil")
assert.Equal(t, "DEN", office.Iata, "office IATA should be 'DEN'")
addr.Latitude, addr.Longitude = randomGPSLocation(office)
// fmt.Printf("office %v address %v\n", office, addr)
delay := localDelayHours(addr.Latitude, addr.Longitude, office)
// fmt.Printf("time delay %f\n", delay)
assert.Less(t, delay, 7.0, "local time delay should be less than 7 hours")
} | explode_data.jsonl/75436 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 212
} | [
2830,
3393,
13999,
4286,
1155,
353,
8840,
836,
8,
341,
11009,
12419,
445,
2271,
13999,
4286,
1138,
53183,
1669,
609,
4286,
515,
197,
76424,
51074,
25,
330,
8281,
756,
197,
532,
197,
26516,
1669,
1477,
23914,
1359,
1397,
24497,
18942,
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... | 1 |
func TestMatTransform(t *testing.T) {
src := IMRead("images/lut.png", 1)
dst := NewMat()
tm := NewMatWithSize(4, 4, MatTypeCV8UC4)
Transform(src, &dst, tm)
if dst.Empty() {
t.Error("Transform error")
}
} | explode_data.jsonl/81720 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 92
} | [
2830,
3393,
11575,
8963,
1155,
353,
8840,
836,
8,
341,
41144,
1669,
6517,
4418,
445,
3642,
13328,
332,
3508,
497,
220,
16,
340,
52051,
1669,
1532,
11575,
741,
3244,
76,
1669,
1532,
11575,
2354,
1695,
7,
19,
11,
220,
19,
11,
6867,
92... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestPing(t *testing.T) {
api := httpexpect.New(t, apiURL)
api.POST("/ping").
Expect().
Status(http.StatusOK).
Body().Equal("pong")
api.POST("/ping/hello").
Expect().
Status(http.StatusOK).
Body().Equal("Hello, ")
api.POST("/ping/hello").
WithBytes([]byte("World")).
Expect().
Status(http.StatusOK).
Body().Equal("Hello, World")
req := ping.Request{Name: "My Name"}
api.POST("/ping/reqrsp").
WithJSON(req).
Expect().
ContentType("application/json").
Status(http.StatusOK).
JSON().Object().
Value("Response").String().Equal("Hello, My Name")
// method which returns error
api.POST("/ping/reqrsp2").
Expect().
ContentType("").
Status(http.StatusInternalServerError).
Header("x-api-error").Equal("request not found")
// method which don't exists
api.POST("/ping/non-existent-method").
Expect().
Status(http.StatusNotImplemented)
} | explode_data.jsonl/64176 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 345
} | [
2830,
3393,
69883,
1155,
353,
8840,
836,
8,
341,
54299,
1669,
1758,
17119,
7121,
1155,
11,
6330,
3144,
692,
54299,
14721,
4283,
9989,
38609,
197,
35911,
25829,
197,
58321,
19886,
52989,
4292,
197,
197,
5444,
1005,
2993,
445,
59102,
5130,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestHTMLEscape(t *testing.T) {
testtype.SkipUnlessTestType(t, testtype.UnitTestType)
var b, want bytes.Buffer
m := `{"M":"<html>foo &` + "\xe2\x80\xa8 \xe2\x80\xa9" + `</html>"}`
want.Write([]byte(`{"M":"\u003chtml\u003efoo \u0026\u2028 \u2029\u003c/html\u003e"}`))
HTMLEscape(&b, []byte(m))
if !bytes.Equal(b.Bytes(), want.Bytes()) {
t.Errorf("HTMLEscape(&b, []byte(m)) = %s; want %s", b.Bytes(), want.Bytes())
}
} | explode_data.jsonl/4574 | {
"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,
2545,
25045,
57518,
1155,
353,
8840,
836,
8,
341,
18185,
1313,
57776,
35587,
2271,
929,
1155,
11,
1273,
1313,
25159,
2271,
929,
692,
2405,
293,
11,
1366,
5820,
22622,
198,
2109,
1669,
1565,
4913,
44,
3252,
27,
1551,
29,
79... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
func TestIntegrationTokenAuth(t *testing.T) {
if testing.Short() || testRundeckRunning() == false {
t.Skip("skipping integration testing")
}
client, err := rundeck.NewTokenAuthClient(testIntegrationToken, testIntegrationURL)
require.NoError(t, err)
info, infoErr := client.GetSystemInfo()
require.NoError(t, infoErr)
require.NotNil(t, info)
} | explode_data.jsonl/63131 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 125
} | [
2830,
3393,
52464,
3323,
5087,
1155,
353,
8840,
836,
8,
341,
743,
7497,
55958,
368,
1369,
1273,
49,
28865,
377,
18990,
368,
621,
895,
341,
197,
3244,
57776,
445,
4886,
5654,
17590,
7497,
1138,
197,
532,
25291,
11,
1848,
1669,
435,
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... | 3 |
func TestIterateCallBack_PrefixWithoutExecAddr(t *testing.T) {
key := "mavl-coins-bty-exec-16htvcBNSEA7fZhAdLJphDwQRQJaHpyHTp:1JmFaA6unrCFYEWPGRi7uuXY1KthTJxJEP"
//prefix1 := "mavl-coins-bty-exec-16htvcBNSEA7fZhAdLJphDwQRQJaHpyHTp:"
prefix2 := "mavl-coins-bty-exec-"
//execAddr := "16htvcBNSEA7fZhAdLJphDwQRQJaHpyHTp"
addr := "1JmFaA6unrCFYEWPGRi7uuXY1KthTJxJEP"
var reply = &StoreListReply{
Start: []byte(prefix2),
End: genPrefixEdge([]byte(prefix2)),
Suffix: []byte(addr),
Mode: int64(2),
Count: int64(100),
}
var acc = &Account{
Currency: 0,
Balance: 1,
Frozen: 1,
Addr: addr,
}
value := Encode(acc)
bRet := reply.IterateCallBack([]byte(key), value)
assert.Equal(t, false, bRet)
assert.Equal(t, 1, len(reply.Keys))
assert.Equal(t, 1, len(reply.Values))
assert.Equal(t, int64(1), reply.Num)
assert.Equal(t, 0, len(reply.NextKey))
bRet = reply.IterateCallBack([]byte(key), value)
assert.Equal(t, false, bRet)
assert.Equal(t, 2, len(reply.Keys))
assert.Equal(t, 2, len(reply.Values))
assert.Equal(t, int64(2), reply.Num)
assert.Equal(t, 0, len(reply.NextKey))
key2 := "mavl-coins-bty-exec-16htvcBNSEA7fZhAdLJphDwQRQJaHpyHTp:2JmFaA6unrCFYEWPGRi7uuXY1KthTJxJEP"
bRet = reply.IterateCallBack([]byte(key2), value)
assert.Equal(t, false, bRet)
assert.Equal(t, 2, len(reply.Keys))
assert.Equal(t, 2, len(reply.Values))
assert.Equal(t, int64(2), reply.Num)
assert.Equal(t, 0, len(reply.NextKey))
key3 := "mavl-coins-bty-exec-26htvcBNSEA7fZhAdLJphDwQRQJaHpyHTp:1JmFaA6unrCFYEWPGRi7uuXY1KthTJxJEP"
bRet = reply.IterateCallBack([]byte(key3), value)
assert.Equal(t, false, bRet)
assert.Equal(t, 3, len(reply.Keys))
assert.Equal(t, 3, len(reply.Values))
assert.Equal(t, int64(3), reply.Num)
assert.Equal(t, 0, len(reply.NextKey))
reply.Count = int64(4)
bRet = reply.IterateCallBack([]byte(key3), value)
assert.Equal(t, true, bRet)
assert.Equal(t, 4, len(reply.Keys))
assert.Equal(t, 4, len(reply.Values))
assert.Equal(t, int64(4), reply.Num)
assert.Equal(t, key3, string(reply.NextKey))
fmt.Println(string(reply.NextKey))
} | explode_data.jsonl/58328 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 1027
} | [
2830,
3393,
8537,
349,
67273,
1088,
5060,
26040,
10216,
13986,
1155,
353,
8840,
836,
8,
341,
23634,
1669,
330,
76,
67311,
22471,
1330,
1455,
1881,
70721,
12,
16,
21,
426,
7362,
15594,
91952,
22,
69,
83678,
2589,
43,
41,
759,
35,
86,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestManifestAutoCompaction(t *testing.T) {
ctx := testlogging.Context(t)
data := blobtesting.DataMap{}
for i := 0; i < 100; i++ {
mgr := newManagerForTesting(ctx, t, data)
item1 := map[string]int{"foo": 1, "bar": 2}
labels1 := map[string]string{"type": "item", "color": "red"}
addAndVerify(ctx, t, mgr, labels1, item1)
mgr.Flush(ctx)
}
} | explode_data.jsonl/77799 | {
"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,
38495,
13253,
13552,
1311,
1155,
353,
8840,
836,
8,
341,
20985,
1669,
1273,
25263,
9328,
1155,
340,
8924,
1669,
23404,
8840,
3336,
2227,
31483,
2023,
600,
1669,
220,
15,
26,
600,
366,
220,
16,
15,
15,
26,
600,
1027,
341,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
func TestLevelApplies(t *testing.T) {
type unit struct {
key string
val string
exp zapcore.Level
}
tests := []unit{
{KeyLogLevel, "", zapcore.WarnLevel},
{KeyLogLevel, "info", zapcore.InfoLevel},
{KeyLogLevel, "debug", zapcore.DebugLevel},
{KeyLogLevel, "warn", zapcore.WarnLevel},
{KeyLogLevel, "error", zapcore.ErrorLevel},
{KeyLogLevel, "dpanic", zapcore.DPanicLevel},
{KeyLogLevel, "panic", zapcore.PanicLevel},
{KeyLogLevel, "fatal", zapcore.FatalLevel},
}
for _, test := range tests {
Reset()
os.Setenv(test.key, test.val)
z, err := RootLogger()
unsetEnv(test.key)
require.NotNil(t, z)
require.NoError(t, err)
c := z.Check(test.exp, "")
require.NotNil(t, c, "Expectation level applies failed! Wanted: %s.", test.exp)
require.Equal(t, c.Level, test.exp, "Wanted: %s, Got: %s", c.Level, test.exp)
}
} | explode_data.jsonl/63196 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 369
} | [
2830,
3393,
4449,
10611,
7202,
1155,
353,
8840,
836,
8,
341,
13158,
4982,
2036,
341,
197,
23634,
914,
198,
197,
19302,
914,
198,
197,
48558,
32978,
2153,
25259,
198,
197,
630,
78216,
1669,
3056,
3843,
515,
197,
197,
90,
1592,
72676,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestImportImportRequestResponsePairs_CanImportAMultiplePairsAndSetTemplateExplicitlyOrExplicitly(t *testing.T) {
RegisterTestingT(t)
cache := cache.NewInMemoryCache()
cfg := Configuration{Webserver: false}
cacheMatcher := matching.CacheMatcher{RequestCache: cache, Webserver: cfg.Webserver}
hv := Hoverfly{Cfg: &cfg, CacheMatcher: cacheMatcher, Simulation: models.NewSimulation()}
RegisterTestingT(t)
originalPair1 := v2.RequestMatcherResponsePairViewV5{
Response: v2.ResponseDetailsViewV5{
Status: 200,
Body: "hello_world",
EncodedBody: false,
Headers: map[string][]string{"Hoverfly": []string{"testing"}},
},
RequestMatcher: v2.RequestMatcherViewV5{
Path: []v2.MatcherViewV5{
{
Matcher: matchers.Exact,
Value: "/",
},
},
Method: []v2.MatcherViewV5{
{
Matcher: matchers.Exact,
Value: "GET",
},
},
Destination: []v2.MatcherViewV5{
{
Matcher: matchers.Exact,
Value: "/",
},
},
Scheme: []v2.MatcherViewV5{
{
Matcher: matchers.Exact,
Value: "scheme",
},
},
Body: []v2.MatcherViewV5{
{
Matcher: matchers.Exact,
Value: "",
},
},
Headers: map[string][]v2.MatcherViewV5{
"Hoverfly": []v2.MatcherViewV5{
{
Matcher: matchers.Exact,
Value: "testing",
},
},
}}}
originalPair2 := originalPair1
originalPair2.Response.Templated = false
originalPair2.RequestMatcher.Path = []v2.MatcherViewV5{
{
Matcher: matchers.Exact,
Value: "/new/path",
},
}
originalPair3 := originalPair1
originalPair3.RequestMatcher.Path = []v2.MatcherViewV5{
{
Matcher: matchers.Exact,
Value: "/newer/path",
},
}
originalPair3.Response.Templated = true
result := hv.importRequestResponsePairViews([]v2.RequestMatcherResponsePairViewV5{originalPair1, originalPair2, originalPair3})
Expect(result.WarningMessages).To(HaveLen(0))
Expect(hv.Simulation.GetMatchingPairs()).To(HaveLen(3))
Expect(hv.Simulation.GetMatchingPairs()[0]).To(Equal(models.RequestMatcherResponsePair{
Response: models.ResponseDetails{
Status: 200,
Body: "hello_world",
Headers: map[string][]string{"Hoverfly": []string{"testing"}},
Templated: false,
},
RequestMatcher: models.RequestMatcher{
Path: []models.RequestFieldMatchers{
{
Matcher: matchers.Exact,
Value: "/",
},
},
Method: []models.RequestFieldMatchers{
{
Matcher: matchers.Exact,
Value: "GET",
},
},
Destination: []models.RequestFieldMatchers{
{
Matcher: matchers.Exact,
Value: "/",
},
},
Scheme: []models.RequestFieldMatchers{
{
Matcher: matchers.Exact,
Value: "scheme",
},
},
Body: []models.RequestFieldMatchers{
{
Matcher: matchers.Exact,
Value: "",
},
},
Headers: map[string][]models.RequestFieldMatchers{
"Hoverfly": []models.RequestFieldMatchers{
{
Matcher: matchers.Exact,
Value: "testing",
},
},
},
},
}))
Expect(hv.Simulation.GetMatchingPairs()[1]).To(Equal(models.RequestMatcherResponsePair{
Response: models.ResponseDetails{
Status: 200,
Body: "hello_world",
Headers: map[string][]string{"Hoverfly": []string{"testing"}},
Templated: false,
},
RequestMatcher: models.RequestMatcher{
Path: []models.RequestFieldMatchers{
{
Matcher: matchers.Exact,
Value: "/new/path",
},
},
Method: []models.RequestFieldMatchers{
{
Matcher: matchers.Exact,
Value: "GET",
},
},
Destination: []models.RequestFieldMatchers{
{
Matcher: matchers.Exact,
Value: "/",
},
},
Scheme: []models.RequestFieldMatchers{
{
Matcher: matchers.Exact,
Value: "scheme",
},
},
Body: []models.RequestFieldMatchers{
{
Matcher: matchers.Exact,
Value: "",
},
},
Headers: map[string][]models.RequestFieldMatchers{
"Hoverfly": []models.RequestFieldMatchers{
{
Matcher: matchers.Exact,
Value: "testing",
},
},
},
},
}))
Expect(hv.Simulation.GetMatchingPairs()[2]).To(Equal(models.RequestMatcherResponsePair{
Response: models.ResponseDetails{
Status: 200,
Body: "hello_world",
Headers: map[string][]string{"Hoverfly": []string{"testing"}},
Templated: true,
},
RequestMatcher: models.RequestMatcher{
Path: []models.RequestFieldMatchers{
{
Matcher: matchers.Exact,
Value: "/newer/path",
},
},
Method: []models.RequestFieldMatchers{
{
Matcher: matchers.Exact,
Value: "GET",
},
},
Destination: []models.RequestFieldMatchers{
{
Matcher: matchers.Exact,
Value: "/",
},
},
Scheme: []models.RequestFieldMatchers{
{
Matcher: matchers.Exact,
Value: "scheme",
},
},
Body: []models.RequestFieldMatchers{
{
Matcher: matchers.Exact,
Value: "",
},
},
Headers: map[string][]models.RequestFieldMatchers{
"Hoverfly": []models.RequestFieldMatchers{
{
Matcher: matchers.Exact,
Value: "testing",
},
},
},
},
}))
} | explode_data.jsonl/75454 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 2480
} | [
2830,
3393,
11511,
11511,
1900,
2582,
54228,
920,
276,
11511,
1402,
12229,
54228,
3036,
1649,
7275,
98923,
398,
2195,
98923,
398,
1155,
353,
8840,
836,
8,
341,
79096,
16451,
51,
1155,
692,
52680,
1669,
6500,
7121,
641,
10642,
8233,
741,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestDebugCallPanic(t *testing.T) {
skipUnderDebugger(t)
// This can deadlock if there aren't enough threads.
defer runtime.GOMAXPROCS(runtime.GOMAXPROCS(8))
ready := make(chan *runtime.G)
var stop uint32
defer atomic.StoreUint32(&stop, 1)
go func() {
runtime.LockOSThread()
defer runtime.UnlockOSThread()
ready <- runtime.Getg()
for atomic.LoadUint32(&stop) == 0 {
}
}()
g := <-ready
p, err := runtime.InjectDebugCall(g, func() { panic("test") }, nil, nil, debugCallTKill, false)
if err != nil {
t.Fatal(err)
}
if ps, ok := p.(string); !ok || ps != "test" {
t.Fatalf("wanted panic %v, got %v", "test", p)
}
} | explode_data.jsonl/9341 | {
"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,
7939,
7220,
47,
31270,
1155,
353,
8840,
836,
8,
341,
1903,
13389,
16250,
67239,
1155,
692,
197,
322,
1096,
646,
93345,
421,
1052,
7629,
944,
3322,
14564,
624,
16867,
15592,
1224,
1898,
2954,
9117,
6412,
89467,
1224,
1898,
29... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
func TestLog_pipelinerun_status_done(t *testing.T) {
var (
pipelineName = "done-pipeline"
prName = "done-run"
ns = "namespace"
taskName = "done-task"
)
nsList := []*corev1.Namespace{
{
ObjectMeta: metav1.ObjectMeta{
Name: ns,
},
},
}
prs := []*v1alpha1.PipelineRun{
tb.PipelineRun(prName,
tb.PipelineRunNamespace(ns),
tb.PipelineRunLabel("tekton.dev/pipeline", prName),
tb.PipelineRunSpec(pipelineName),
tb.PipelineRunStatus(
tb.PipelineRunStatusCondition(apis.Condition{
Type: apis.ConditionSucceeded,
Status: corev1.ConditionUnknown,
Message: "Running",
}),
),
),
}
ps := []*v1alpha1.Pipeline{
tb.Pipeline(pipelineName,
tb.PipelineNamespace(ns),
tb.PipelineSpec(
tb.PipelineTask(taskName, taskName),
),
),
}
cs, _ := test.SeedTestData(t, pipelinetest.Data{PipelineRuns: prs, Pipelines: ps, Namespaces: nsList})
cs.Pipeline.Resources = cb.APIResourceList(versionA1, []string{"pipeline", "pipelinerun"})
watcher := watch.NewFake()
tdc := testDynamic.Options{WatchResource: "pipelineruns", Watcher: watcher}
dc, err := tdc.Client(
cb.UnstructuredP(ps[0], versionA1),
cb.UnstructuredPR(prs[0], versionA1),
)
if err != nil {
t.Errorf("unable to create dynamic client: %v", err)
}
prlo := logOptsv1aplha1(prName, ns, cs, dc, fake.Streamer([]fake.Log{}), false, false)
go func() {
time.Sleep(time.Second * 1)
for _, pr := range prs {
pr.Status.Conditions[0].Status = corev1.ConditionTrue
pr.Status.Conditions[0].Message = "completed"
watcher.Modify(pr)
}
}()
start := time.Now()
output, err := fetchLogs(prlo)
elapsed := time.Since(start).Seconds()
if err != nil {
t.Errorf("Unexpected error: %v", err)
}
if elapsed > 10 {
t.Errorf("Timed out")
}
test.AssertOutput(t, "", output)
} | explode_data.jsonl/14865 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 847
} | [
2830,
3393,
2201,
620,
81079,
10453,
359,
4773,
24390,
1155,
353,
8840,
836,
8,
341,
2405,
2399,
197,
3223,
8790,
675,
284,
330,
10438,
2268,
8790,
698,
197,
25653,
675,
981,
284,
330,
10438,
22973,
698,
197,
84041,
1843,
284,
330,
22... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
func TestWrite_Progress_DedupeLayers(t *testing.T) {
img := empty.Image
for i := 0; i < 10; i++ {
l, err := random.Layer(1000, types.OCILayer)
if err != nil {
t.Fatal(err)
}
img, err = mutate.AppendLayers(img, l)
if err != nil {
t.Fatal(err)
}
}
c := make(chan v1.Update, 200)
// Set up a fake registry.
s := httptest.NewServer(registry.New())
defer s.Close()
u, err := url.Parse(s.URL)
if err != nil {
t.Fatal(err)
}
dst := fmt.Sprintf("%s/test/progress/upload", u.Host)
ref, err := name.ParseReference(dst)
if err != nil {
t.Fatal(err)
}
if err := Write(ref, img, WithProgress(c)); err != nil {
t.Fatalf("Write: %v", err)
}
if err := checkUpdates(c); err != nil {
t.Fatal(err)
}
} | explode_data.jsonl/76475 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 335
} | [
2830,
3393,
7985,
16670,
2483,
1557,
55101,
375,
40235,
1155,
353,
8840,
836,
8,
341,
39162,
1669,
4287,
7528,
198,
2023,
600,
1669,
220,
15,
26,
600,
366,
220,
16,
15,
26,
600,
1027,
341,
197,
8810,
11,
1848,
1669,
4194,
66074,
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... | 8 |
func TestManyEvents(t *testing.T) {
ch := setupTest(t)
// post a request that issues too many events (nEvents)
tx, _, err := ch.PostRequestSyncTx(
solo.NewCallParams(manyEventsContract.Name, funcManyEvents.Name).WithIotas(1),
nil,
)
require.Error(t, err) // error expected (too many events)
reqs, err := ch.Env.RequestsForChain(tx, ch.ChainID)
require.NoError(t, err)
reqID := reqs[0].ID()
checkNEvents(t, ch, reqID, 0) // no events are saved
// allow for more events per request in root contract
_, err = ch.PostRequestSync(
solo.NewCallParams(
governance.Contract.Name, governance.FuncSetChainInfo.Name,
governance.ParamMaxEventsPerRequest, uint16(nEvents),
).WithIotas(1),
nil,
)
require.NoError(t, err)
// check events are now saved
tx, _, err = ch.PostRequestSyncTx(
solo.NewCallParams(manyEventsContract.Name, funcManyEvents.Name).WithIotas(1),
nil,
)
require.NoError(t, err)
reqs, err = ch.Env.RequestsForChain(tx, ch.ChainID)
require.NoError(t, err)
reqID = reqs[0].ID()
checkNEvents(t, ch, reqID, nEvents)
} | explode_data.jsonl/69725 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 418
} | [
2830,
3393,
8441,
7900,
1155,
353,
8840,
836,
8,
341,
23049,
1669,
6505,
2271,
1155,
692,
197,
322,
1736,
264,
1681,
429,
4714,
2238,
1657,
4357,
320,
77,
7900,
340,
46237,
11,
8358,
1848,
1669,
521,
23442,
1900,
12154,
31584,
1006,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestStepConfig(t *testing.T) {
// a raft that cannot make progress
r := newRaft(1, []uint64{1, 2}, 10, 1, NewMemoryStorage(), 0)
r.becomeCandidate()
r.becomeLeader()
index := r.raftLog.lastIndex()
r.Step(pb.Message{From: 1, To: 1, Type: pb.MsgProp, Entries: []pb.Entry{{Type: pb.EntryConfChange}}})
if g := r.raftLog.lastIndex(); g != index+1 {
t.Errorf("index = %d, want %d", g, index+1)
}
if r.pendingConf != true {
t.Errorf("pendingConf = %v, want true", r.pendingConf)
}
} | explode_data.jsonl/67365 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 207
} | [
2830,
3393,
8304,
2648,
1155,
353,
8840,
836,
8,
341,
197,
322,
264,
52455,
429,
4157,
1281,
5098,
198,
7000,
1669,
501,
55535,
723,
7,
16,
11,
3056,
2496,
21,
19,
90,
16,
11,
220,
17,
2137,
220,
16,
15,
11,
220,
16,
11,
1532,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
func TestPeer_IsClosed(t *testing.T) {
t.Parallel()
s := makeSetup(t)
assert.False(t, s.alice.peer.IsClosed(), "fresh peer must be open")
assert.NoError(t, s.alice.peer.Close(), "closing must succeed")
assert.True(t, s.alice.peer.IsClosed(), "closed peer must be closed")
} | explode_data.jsonl/51239 | {
"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,
30888,
31879,
26884,
1155,
353,
8840,
836,
8,
341,
3244,
41288,
7957,
741,
1903,
1669,
1281,
21821,
1155,
340,
6948,
50757,
1155,
11,
274,
12168,
558,
72864,
4506,
26884,
1507,
330,
71308,
14397,
1969,
387,
1787,
1138,
6948,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestGetHostname(t *testing.T) {
log.Println("Test GetHostname")
res, err := testDevice.GetHostname()
if err != nil {
t.Error(err)
}
js := prettyJSON(&res)
fmt.Println(js)
} | explode_data.jsonl/60357 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 78
} | [
2830,
3393,
1949,
88839,
1155,
353,
8840,
836,
8,
341,
6725,
12419,
445,
2271,
2126,
88839,
5130,
10202,
11,
1848,
1669,
1273,
6985,
2234,
88839,
741,
743,
1848,
961,
2092,
341,
197,
3244,
6141,
3964,
340,
197,
630,
95636,
1669,
5020,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestInjectVolumeMountIntoDeployment(t *testing.T) {
tests := []struct {
name string
podSpec *corev1.PodSpec
volumeMounts []corev1.VolumeMount
expected *corev1.PodSpec
}{
{
// The container does not define a VolumeMount and is injected with an empty list of VolumeMounts.
// Expected: The container's VolumeMount list remains empty.
name: "EmptyVolumeMounts",
podSpec: &corev1.PodSpec{
Containers: []corev1.Container{
corev1.Container{},
},
},
volumeMounts: []corev1.VolumeMount{},
expected: &corev1.PodSpec{
Containers: []corev1.Container{
corev1.Container{},
},
},
},
{
// The container does not define a VolumeMount and is injected with a single VolumeMount.
// Expected: The container contains the injected VolumeMount.
name: "WithContainerHasNoVolumeMounts",
podSpec: &corev1.PodSpec{
Containers: []corev1.Container{
corev1.Container{},
},
},
volumeMounts: defaultVolumeMounts,
expected:&corev1.PodSpec{
Containers: []corev1.Container{
corev1.Container{
VolumeMounts: defaultVolumeMounts,
},
},
},
},
{
// The container defines a single VolumeMount which is injected with an empty VolumeMount list.
// Expected: The container's VolumeMount list is unchanged.
name: "WithContainerHasVolumeMountsEmptyDefaults",
podSpec: &corev1.PodSpec{
Containers: []corev1.Container{
corev1.Container{
VolumeMounts: defaultVolumeMounts,
},
},
},
volumeMounts: []corev1.VolumeMount{},
expected: &corev1.PodSpec{
Containers: []corev1.Container{
corev1.Container{
VolumeMounts: defaultVolumeMounts,
},
},
},
},
{
// The container defines a single VolumeMount and is injected with a new VolumeMount.
// Expected: The container's VolumeMount list is updated to contain both VolumeMounts.
name: "WithContainerHasNonOverlappingEnvVar",
podSpec: &corev1.PodSpec{
Containers: []corev1.Container{
corev1.Container{
VolumeMounts: []corev1.VolumeMount{
corev1.VolumeMount{
Name: "bar",
MountPath: "/foo",
},
},
},
},
},
volumeMounts: defaultVolumeMounts,
expected: &corev1.PodSpec{
Containers: []corev1.Container{
corev1.Container{
VolumeMounts: []corev1.VolumeMount{
corev1.VolumeMount{
Name: "bar",
MountPath: "/foo",
},
corev1.VolumeMount{
Name: "foo",
MountPath: "/bar",
},
},
},
},
},
},
{
// The container defines a single VolumeMount that has a name conflict with
// a VolumeMount being injected.
// Expected: The VolumeMount is overwritten.
name: "WithContainerHasOverlappingVolumeMounts",
podSpec: &corev1.PodSpec{
Containers: []corev1.Container{
corev1.Container{
VolumeMounts: []corev1.VolumeMount{
corev1.VolumeMount{
Name: "foo",
MountPath: "/barbar",
},
},
},
},
},
volumeMounts: defaultVolumeMounts,
expected: &corev1.PodSpec{
Containers: []corev1.Container{
corev1.Container{
VolumeMounts: []corev1.VolumeMount{
corev1.VolumeMount{
Name: "foo",
MountPath: "/bar",
},
},
},
},
},
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
overrides.InjectVolumeMountsIntoDeployment(tt.podSpec, tt.volumeMounts)
podSpecWant := tt.expected
podSpecGot := tt.podSpec
assert.Equal(t, podSpecWant, podSpecGot)
})
}
} | explode_data.jsonl/4028 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 1602
} | [
2830,
3393,
13738,
18902,
16284,
26591,
75286,
1155,
353,
8840,
836,
8,
341,
78216,
1669,
3056,
1235,
341,
197,
11609,
257,
914,
198,
197,
3223,
347,
8327,
220,
353,
98645,
16,
88823,
8327,
198,
197,
5195,
4661,
16284,
82,
256,
3056,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestGetFileContentTypePDF(t *testing.T) {
file := `../testdata/files/test2.pdf`
fileType, err := GetFileContentType(file)
if err != nil {
t.Log("Error -> ", err)
t.Fail()
}
t.Log(fileType)
} | explode_data.jsonl/24006 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 85
} | [
2830,
3393,
1949,
1703,
29504,
23424,
1155,
353,
8840,
836,
8,
341,
17661,
1669,
1565,
1244,
92425,
33220,
12697,
17,
15995,
3989,
17661,
929,
11,
1848,
1669,
2126,
1703,
29504,
4866,
692,
743,
1848,
961,
2092,
341,
197,
3244,
5247,
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
] | 2 |
func TestParser_ParseRouterApiPOST(t *testing.T) {
src := `
package test
// @Router /api/{id} [post]
func Test(){
}
`
f, err := goparser.ParseFile(token.NewFileSet(), "", src, goparser.ParseComments)
assert.NoError(t, err)
p := New()
err = p.ParseRouterAPIInfo("", f)
assert.NoError(t, err)
ps := p.swagger.Paths.Paths
val, ok := ps["/api/{id}"]
assert.True(t, ok)
assert.NotNil(t, val.Post)
} | explode_data.jsonl/63572 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 181
} | [
2830,
3393,
6570,
77337,
9523,
6563,
2946,
1155,
353,
8840,
836,
8,
341,
41144,
1669,
22074,
1722,
1273,
271,
322,
569,
9523,
608,
2068,
9388,
307,
92,
508,
2203,
921,
2830,
3393,
3032,
532,
3989,
1166,
11,
1848,
1669,
342,
453,
10425... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestReadPrivateKeyRing(t *testing.T) {
kring, err := ReadKeyRing(readerFromHex(testKeys1And2PrivateHex))
if err != nil {
t.Error(err)
return
}
if len(kring) != 2 || uint32(kring[0].PrimaryKey.KeyId) != 0xC20C31BB || uint32(kring[1].PrimaryKey.KeyId) != 0x1E35246B || kring[0].PrimaryKey == nil {
t.Errorf("bad keyring: %#v", kring)
}
} | explode_data.jsonl/2272 | {
"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,
4418,
75981,
43466,
1155,
353,
8840,
836,
8,
341,
197,
9855,
287,
11,
1848,
1669,
4457,
1592,
43466,
21987,
3830,
20335,
8623,
8850,
16,
3036,
17,
16787,
20335,
1171,
743,
1848,
961,
2092,
341,
197,
3244,
6141,
3964,
340,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 6 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.