describe("resetGraphs", () => { it("resets zoom level and scroll offsets", () => { sandbox.stub(metricsProvider, "setZoomLevel").callsFake((zoom) => { expect(zoom) .to.be.a("number") .that.equals(0); }); _.each(AGGREGATE_TIME_LEVELS, (level) => { expect(metricsProvider) .to.be.an("object") .with.property("_aggregation") .which.is.an("object") .with.property(level) .which.is.an("object") .with.property("scrollOffset") .which.is.a("number") .that.equals(0); }); metricsProvider.resetGraphs(); }); });
describe("startGraphs", () => { it("offsets at the end or the beginning of the data set", () => { // load some data fill(100, 500); sandbox.stub(metricsProvider, "adjustScrollOffset").callsFake((direction) => { let length = metricsProvider._aggregation[AGGREGATE_TIME_LEVELS[0]].data.length; length = direction < 0 ? -length : Number(length); expect(direction) .to.be.a("number") .that.equals(length); }); metricsProvider.startGraphs(-1); metricsProvider.startGraphs(+1); }); });
.with.property("metricA") .with.property("valueA") .that.equals(mockMetrics[index].metricA.valueA); .with.property("metricB") .with.property("valueA") .that.equals(mockMetrics[index].metricB.valueA); .with.property("metricB") .with.property("valueB") .that.equals(mockMetrics[index].metricB.valueB); }); });
// receiving metrics now would cause an emit sandbox.stub(metricsProvider, "emit").callsFake((key, data, discardEvent) => { if (discardEvent) { return; } expect(key) .to.be.a("string") .that.equals("metrics"); expect(data) .to.be.an("object") .that.deep.equals( _.last(metricsProvider._aggregation[metricsProvider.zoomLevelKey].data) ); });
it('load kubeconfig from provided array of paths', () => { const cfgPaths = [ './backends/request/config.test/fixtures/kube-fixture.yml', './backends/request/config.test/fixtures/kube-fixture-two.yml' ] const args = config.fromKubeconfig(cfgPaths) expect(args.url).equals('https://192.168.42.121:8443') })
describe('.loadKubeconfig', () => { const cfgPaths = [ './backends/request/config.test/fixtures/kube-fixture.yml', './backends/request/config.test/fixtures/kube-fixture-two.yml' ] it('supports multiple config files', () => { const args = config.loadKubeconfig(cfgPaths) expect(args.contexts[0].name).equals('foo-context-1') expect(args.contexts[1].name).equals('foo-ramp-up') }) it('supports multiple config files in KUBECONFIG', () => { const delimiter = process.platform === 'win32' ? ';' : ':' process.env.KUBECONFIG = cfgPaths.join(delimiter) const args = config.loadKubeconfig() expect(args.contexts[0].name).equals('foo-context-1') expect(args.contexts[1].name).equals('foo-ramp-up') delete process.env.KUBECONFIG }) })
expect(pod.body.metadata.annotations['patch-test0']).equals(process.pid.toString()) }) })
expect(args.auth.request.bearer).equals('foo-token') })
expect(args.auth.bearer).equals('foo-token') })
expect(args.auth.bearer).equals('foo-token') })
it('load kubeconfig from provided path', () => { const args = config.fromKubeconfig('./backends/request/config.test/fixtures/kube-fixture.yml') expect(args.url).equals('https://192.168.42.121:8443') })