var _ = framework.KubeDescribe("MetricsGrabber", func() { f := framework.NewDefaultFramework("metrics-grabber") var c clientset.Interface var grabber *metrics.MetricsGrabber BeforeEach(func() { var err error c = f.ClientSet framework.ExpectNoError(err) grabber, err = metrics.NewMetricsGrabber(c, true, true, true, true) framework.ExpectNoError(err) }) It("should grab all metrics from API server.", func() { By("Connecting to /metrics endpoint") response, err := grabber.GrabFromApiServer() framework.ExpectNoError(err) Expect(response).NotTo(BeEmpty()) }) It("should grab all metrics from a Kubelet.", func() { By("Proxying to Node through the API server") nodes := framework.GetReadySchedulableNodesOrDie(f.ClientSet) Expect(nodes.Items).NotTo(BeEmpty()) response, err := grabber.GrabFromKubelet(nodes.Items[0].Name) framework.ExpectNoError(err) Expect(response).NotTo(BeEmpty()) }) It("should grab all metrics from a Scheduler.", func() { By("Proxying to Pod through the API server")
var _ = framework.KubeDescribe("MetricsGrabber", func() { f := framework.NewDefaultFramework("metrics-grabber") var c *client.Client var grabber *metrics.MetricsGrabber BeforeEach(func() { var err error c = f.Client framework.ExpectNoError(err) grabber, err = metrics.NewMetricsGrabber(c, true, true, true, true) framework.ExpectNoError(err) }) It("should grab all metrics from API server.", func() { By("Connecting to /metrics endpoint") unknownMetrics := sets.NewString() response, err := grabber.GrabFromApiServer(unknownMetrics) framework.ExpectNoError(err) Expect(unknownMetrics).To(BeEmpty()) checkMetrics(metrics.Metrics(response), metrics.KnownApiServerMetrics) }) It("should grab all metrics from a Kubelet.", func() { By("Proxying to Node through the API server") nodes := framework.ListSchedulableNodesOrDie(c) Expect(nodes.Items).NotTo(BeEmpty()) response, err := grabber.GrabFromKubelet(nodes.Items[0].Name) framework.ExpectNoError(err) checkNecessaryMetrics(metrics.Metrics(response), metrics.NecessaryKubeletMetrics) })