mirror of
https://github.com/optim-enterprises-bv/kubernetes.git
synced 2025-11-29 21:03:56 +00:00
e2e framework: move log size verification into framework/debug
This helps getting rid of the ssh dependency. The same init package as for dumping namespaces takes care of adding the functionality back to framework instances.
This commit is contained in:
@@ -14,10 +14,14 @@ See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
// Package init sets debug.DumpAllNamespaceInfo as implementation in the framework.
|
||||
// Package init sets debug.DumpAllNamespaceInfo as implementation in the framework
|
||||
// and enables log size verification.
|
||||
package init
|
||||
|
||||
import (
|
||||
"sync"
|
||||
|
||||
"github.com/onsi/ginkgo/v2"
|
||||
"k8s.io/kubernetes/test/e2e/framework"
|
||||
"k8s.io/kubernetes/test/e2e/framework/debug"
|
||||
)
|
||||
@@ -28,6 +32,31 @@ func init() {
|
||||
f.DumpAllNamespaceInfo = func(f *framework.Framework, ns string) {
|
||||
debug.DumpAllNamespaceInfo(f.ClientSet, ns)
|
||||
}
|
||||
|
||||
if framework.TestContext.GatherLogsSizes {
|
||||
var (
|
||||
wg sync.WaitGroup
|
||||
closeChannel chan bool
|
||||
verifier *debug.LogsSizeVerifier
|
||||
)
|
||||
|
||||
ginkgo.BeforeEach(func() {
|
||||
wg.Add(1)
|
||||
closeChannel = make(chan bool)
|
||||
verifier = debug.NewLogsVerifier(f.ClientSet, closeChannel)
|
||||
go func() {
|
||||
defer wg.Done()
|
||||
verifier.Run()
|
||||
}()
|
||||
ginkgo.DeferCleanup(func() {
|
||||
ginkgo.By("Gathering log sizes data", func() {
|
||||
close(closeChannel)
|
||||
wg.Wait()
|
||||
f.TestSummaries = append(f.TestSummaries, verifier.GetSummary())
|
||||
})
|
||||
})
|
||||
})
|
||||
}
|
||||
},
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user