Update dependencies

This commit is contained in:
Manuel de Brito Fontes 2017-10-06 17:33:32 -03:00
parent bf5616c65b
commit d6d374b28d
13962 changed files with 48226 additions and 3618880 deletions

View file

@ -36,8 +36,8 @@ func (s MySuite) TestGrouperBasic(c *C) {
}
}
gr := NewGrouper(false, newNamer("g1", "g2"))
p1 := newProc(1, "g1", ProcMetrics{1, 2, 3, 4, 5})
p2 := newProc(2, "g2", ProcMetrics{2, 3, 4, 5, 6})
p1 := newProc(1, "g1", ProcMetrics{1, 2, 3, 4, 5, 4, 400})
p2 := newProc(2, "g2", ProcMetrics{2, 3, 4, 5, 6, 40, 400})
p3 := newProc(3, "g3", ProcMetrics{})
_, err := gr.Update(procInfoIter(p1, p2, p3))
@ -45,52 +45,53 @@ func (s MySuite) TestGrouperBasic(c *C) {
got1 := gr.groups()
want1 := GroupCountMap{
"g1": GroupCounts{Counts{0, 0, 0}, 1, 4, 5, time.Time{}},
"g2": GroupCounts{Counts{0, 0, 0}, 1, 5, 6, time.Time{}},
"g1": GroupCounts{Counts{0, 0, 0}, 1, 4, 5, time.Time{}, 4, 0.01},
"g2": GroupCounts{Counts{0, 0, 0}, 1, 5, 6, time.Time{}, 40, 0.1},
}
c.Check(got1, DeepEquals, want1)
c.Check(got1, DeepEquals, want1, Commentf("diff %s", pretty.Compare(got1, want1)))
// Now increment counts and memory and make sure group counts updated.
p1.ProcMetrics = ProcMetrics{2, 3, 4, 5, 6}
p2.ProcMetrics = ProcMetrics{4, 5, 6, 7, 8}
p1.ProcMetrics = ProcMetrics{2, 3, 4, 5, 6, 4, 400}
p2.ProcMetrics = ProcMetrics{4, 5, 6, 7, 8, 40, 400}
_, err = gr.Update(procInfoIter(p1, p2, p3))
c.Assert(err, IsNil)
got2 := gr.groups()
want2 := GroupCountMap{
"g1": GroupCounts{Counts{1, 1, 1}, 1, 5, 6, time.Time{}},
"g2": GroupCounts{Counts{2, 2, 2}, 1, 7, 8, time.Time{}},
"g1": GroupCounts{Counts{1, 1, 1}, 1, 5, 6, time.Time{}, 4, 0.01},
"g2": GroupCounts{Counts{2, 2, 2}, 1, 7, 8, time.Time{}, 40, 0.1},
}
c.Check(got2, DeepEquals, want2)
c.Check(got2, DeepEquals, want2, Commentf("diff %s", pretty.Compare(got2, want2)))
// Now add a new proc and update p2's metrics. The
// counts for p4 won't be factored into the total yet
// because we only add to counts starting with the
// second time we see a proc. Memory is affected though.
p4 := newProc(4, "g2", ProcMetrics{1, 1, 1, 1, 1})
p2.ProcMetrics = ProcMetrics{5, 6, 7, 8, 9}
// second time we see a proc. Memory and FDs are affected
// though.
p4 := newProc(4, "g2", ProcMetrics{1, 1, 1, 1, 1, 80, 400})
p2.ProcMetrics = ProcMetrics{5, 6, 7, 8, 9, 40, 400}
_, err = gr.Update(procInfoIter(p1, p2, p3, p4))
c.Assert(err, IsNil)
got3 := gr.groups()
want3 := GroupCountMap{
"g1": GroupCounts{Counts{0, 0, 0}, 1, 5, 6, time.Time{}},
"g2": GroupCounts{Counts{1, 1, 1}, 2, 9, 10, time.Time{}},
"g1": GroupCounts{Counts{0, 0, 0}, 1, 5, 6, time.Time{}, 4, 0.01},
"g2": GroupCounts{Counts{1, 1, 1}, 2, 9, 10, time.Time{}, 120, 0.2},
}
c.Check(got3, DeepEquals, want3, Commentf("diff %s", pretty.Compare(got3, want3)))
p4.ProcMetrics = ProcMetrics{2, 2, 2, 2, 2}
p2.ProcMetrics = ProcMetrics{6, 7, 8, 8, 9}
p4.ProcMetrics = ProcMetrics{2, 2, 2, 2, 2, 100, 400}
p2.ProcMetrics = ProcMetrics{6, 7, 8, 8, 9, 40, 400}
_, err = gr.Update(procInfoIter(p1, p2, p3, p4))
c.Assert(err, IsNil)
got4 := gr.groups()
want4 := GroupCountMap{
"g1": GroupCounts{Counts{0, 0, 0}, 1, 5, 6, time.Time{}},
"g2": GroupCounts{Counts{2, 2, 2}, 2, 10, 11, time.Time{}},
"g1": GroupCounts{Counts{0, 0, 0}, 1, 5, 6, time.Time{}, 4, 0.01},
"g2": GroupCounts{Counts{2, 2, 2}, 2, 10, 11, time.Time{}, 140, 0.25},
}
c.Check(got4, DeepEquals, want4, Commentf("diff %s", pretty.Compare(got4, want4)))
@ -118,8 +119,8 @@ func (s MySuite) TestGrouperParents(c *C) {
got1 := gr.groups()
want1 := GroupCountMap{
"g1": GroupCounts{Counts{}, 1, 0, 0, time.Time{}},
"g2": GroupCounts{Counts{}, 1, 0, 0, time.Time{}},
"g1": GroupCounts{Counts{}, 1, 0, 0, time.Time{}, 0, 0},
"g2": GroupCounts{Counts{}, 1, 0, 0, time.Time{}, 0, 0},
}
c.Check(got1, DeepEquals, want1, Commentf("diff %s", pretty.Compare(got1, want1)))
@ -135,8 +136,8 @@ func (s MySuite) TestGrouperParents(c *C) {
got2 := gr.groups()
want2 := GroupCountMap{
"g1": GroupCounts{Counts{}, 2, 0, 0, time.Time{}},
"g2": GroupCounts{Counts{}, 2, 0, 0, time.Time{}},
"g1": GroupCounts{Counts{}, 2, 0, 0, time.Time{}, 0, 0},
"g2": GroupCounts{Counts{}, 2, 0, 0, time.Time{}, 0, 0},
}
c.Check(got2, DeepEquals, want2, Commentf("diff %s", pretty.Compare(got2, want2)))
@ -151,8 +152,8 @@ func (s MySuite) TestGrouperParents(c *C) {
got3 := gr.groups()
want3 := GroupCountMap{
"g1": GroupCounts{Counts{}, 1, 0, 0, time.Time{}},
"g2": GroupCounts{Counts{}, 5, 0, 0, time.Time{}},
"g1": GroupCounts{Counts{}, 1, 0, 0, time.Time{}, 0, 0},
"g2": GroupCounts{Counts{}, 5, 0, 0, time.Time{}, 0, 0},
}
c.Check(got3, DeepEquals, want3, Commentf("diff %s", pretty.Compare(got3, want3)))
}
@ -171,23 +172,23 @@ func (s MySuite) TestGrouperGroup(c *C) {
gr := NewGrouper(false, newNamer("g1"))
// First call should return zero CPU/IO.
p1 := newProc(1, "g1", ProcMetrics{1, 2, 3, 4, 5})
p1 := newProc(1, "g1", ProcMetrics{1, 2, 3, 4, 5, 8, 400})
_, err := gr.Update(procInfoIter(p1))
c.Assert(err, IsNil)
got1 := gr.Groups()
want1 := GroupCountMap{
"g1": GroupCounts{Counts{0, 0, 0}, 1, 4, 5, time.Time{}},
"g1": GroupCounts{Counts{0, 0, 0}, 1, 4, 5, time.Time{}, 8, 0.02},
}
c.Check(got1, DeepEquals, want1)
// Second call should return the delta CPU/IO from first observance,
// as well as latest memory/proccount.
p1.ProcMetrics = ProcMetrics{2, 3, 4, 5, 6}
p1.ProcMetrics = ProcMetrics{2, 3, 4, 5, 6, 12, 400}
_, err = gr.Update(procInfoIter(p1))
c.Assert(err, IsNil)
got2 := gr.Groups()
want2 := GroupCountMap{
"g1": GroupCounts{Counts{1, 1, 1}, 1, 5, 6, time.Time{}},
"g1": GroupCounts{Counts{1, 1, 1}, 1, 5, 6, time.Time{}, 12, 0.03},
}
c.Check(got2, DeepEquals, want2)
@ -196,7 +197,7 @@ func (s MySuite) TestGrouperGroup(c *C) {
c.Assert(err, IsNil)
got3 := gr.Groups()
want3 := GroupCountMap{
"g1": GroupCounts{Counts{1, 1, 1}, 1, 5, 6, time.Time{}},
"g1": GroupCounts{Counts{1, 1, 1}, 1, 5, 6, time.Time{}, 12, 0.03},
}
c.Check(got3, DeepEquals, want3, Commentf("diff %s", pretty.Compare(got3, want3)))
}
@ -213,54 +214,54 @@ func (s MySuite) TestGrouperNonDecreasing(c *C) {
}
}
gr := NewGrouper(false, newNamer("g1", "g2"))
p1 := newProc(1, "g1", ProcMetrics{1, 2, 3, 4, 5})
p2 := newProc(2, "g2", ProcMetrics{2, 3, 4, 5, 6})
p1 := newProc(1, "g1", ProcMetrics{1, 2, 3, 4, 5, 4, 400})
p2 := newProc(2, "g2", ProcMetrics{2, 3, 4, 5, 6, 40, 400})
_, err := gr.Update(procInfoIter(p1, p2))
c.Assert(err, IsNil)
got1 := gr.Groups()
want1 := GroupCountMap{
"g1": GroupCounts{Counts{0, 0, 0}, 1, 4, 5, time.Time{}},
"g2": GroupCounts{Counts{0, 0, 0}, 1, 5, 6, time.Time{}},
"g1": GroupCounts{Counts{0, 0, 0}, 1, 4, 5, time.Time{}, 4, 0.01},
"g2": GroupCounts{Counts{0, 0, 0}, 1, 5, 6, time.Time{}, 40, 0.1},
}
c.Check(got1, DeepEquals, want1)
c.Check(got1, DeepEquals, want1, Commentf("diff %s", pretty.Compare(got1, want1)))
// Now add a new proc p3 to g2, and increment p1/p2's metrics.
p1.ProcMetrics = ProcMetrics{2, 3, 4, 5, 6}
p2.ProcMetrics = ProcMetrics{4, 5, 6, 7, 8}
p3 := newProc(3, "g2", ProcMetrics{1, 1, 1, 1, 1})
p1.ProcMetrics = ProcMetrics{2, 3, 4, 5, 6, 8, 400}
p2.ProcMetrics = ProcMetrics{4, 5, 6, 7, 8, 80, 400}
p3 := newProc(3, "g2", ProcMetrics{1, 1, 1, 1, 1, 8, 400})
_, err = gr.Update(procInfoIter(p1, p2, p3))
c.Assert(err, IsNil)
got2 := gr.Groups()
want2 := GroupCountMap{
"g1": GroupCounts{Counts{1, 1, 1}, 1, 5, 6, time.Time{}},
"g2": GroupCounts{Counts{2, 2, 2}, 2, 8, 9, time.Time{}},
"g1": GroupCounts{Counts{1, 1, 1}, 1, 5, 6, time.Time{}, 8, 0.02},
"g2": GroupCounts{Counts{2, 2, 2}, 2, 8, 9, time.Time{}, 88, 0.2},
}
c.Check(got2, DeepEquals, want2)
c.Check(got2, DeepEquals, want2, Commentf("diff %s", pretty.Compare(got2, want2)))
// Now update p3's metrics and kill p2.
p3.ProcMetrics = ProcMetrics{2, 3, 4, 5, 6}
p3.ProcMetrics = ProcMetrics{2, 3, 4, 5, 6, 8, 400}
_, err = gr.Update(procInfoIter(p1, p3))
c.Assert(err, IsNil)
got3 := gr.Groups()
want3 := GroupCountMap{
"g1": GroupCounts{Counts{1, 1, 1}, 1, 5, 6, time.Time{}},
"g2": GroupCounts{Counts{3, 4, 5}, 1, 5, 6, time.Time{}},
"g1": GroupCounts{Counts{1, 1, 1}, 1, 5, 6, time.Time{}, 8, 0.02},
"g2": GroupCounts{Counts{3, 4, 5}, 1, 5, 6, time.Time{}, 8, 0.02},
}
c.Check(got3, DeepEquals, want3, Commentf("diff %s", pretty.Compare(got3, want3)))
// Now update p3's metrics and kill p1.
p3.ProcMetrics = ProcMetrics{4, 4, 4, 2, 1}
p3.ProcMetrics = ProcMetrics{4, 4, 4, 2, 1, 4, 400}
_, err = gr.Update(procInfoIter(p3))
c.Assert(err, IsNil)
got4 := gr.Groups()
want4 := GroupCountMap{
"g1": GroupCounts{Counts{1, 1, 1}, 0, 0, 0, time.Time{}},
"g2": GroupCounts{Counts{5, 5, 5}, 1, 2, 1, time.Time{}},
"g1": GroupCounts{Counts{1, 1, 1}, 0, 0, 0, time.Time{}, 0, 0},
"g2": GroupCounts{Counts{5, 5, 5}, 1, 2, 1, time.Time{}, 4, 0.01},
}
c.Check(got4, DeepEquals, want4, Commentf("diff %s\n%s", pretty.Compare(got4, want4), pretty.Sprint(gr)))