public ScalingSuggestionsMaintainer(NodeRepository nodeRepository,
                                        Duration interval,
                                        Metric metric) {
        super(nodeRepository, interval, metric);
        this.autoscaler = new Autoscaler(nodeRepository);
    }
@Test
    public void testScalingSuggestionsMaintainer() {
        ProvisioningTester tester = new ProvisioningTester.Builder().zone(new Zone(Environment.prod, RegionName.from("us-east3")))
                                                                    .flavorsConfig(flavorsConfig())
                                                                    .build();
        ApplicationId app1 = ProvisioningTester.applicationId("app1");
        ApplicationId app2 = ProvisioningTester.applicationId("app2");
        ClusterSpec cluster1 = ProvisioningTester.containerClusterSpec();
        ClusterSpec cluster2 = ProvisioningTester.contentClusterSpec();
        tester.makeReadyNodes(20, "flt", NodeType.host, 8);
        tester.activateTenantHosts();

        tester.deploy(app1, cluster1, Capacity.from(new ClusterResources(5, 1, new NodeResources(4, 4, 10, 0.1)),
                                                    new ClusterResources(5, 1, new NodeResources(4, 4, 10, 0.1)),
                                                    IntRange.empty(), false, true, Optional.empty(), ClusterInfo.empty()));
        storeCompletion(app1, cluster1.id(), tester.nodeRepository());
        tester.deploy(app2, cluster2, Capacity.from(new ClusterResources(5, 1, new NodeResources(4, 4, 10, 0.1)),
                                                    new ClusterResources(10, 1, new NodeResources(6.5, 5, 15, 0.1)),
                                                    IntRange.empty(), false, true, Optional.empty(), ClusterInfo.empty()));
        storeCompletion(app2, cluster2.id(), tester.nodeRepository());
        tester.clock().advance(Duration.ofHours(13));
        Duration timeAdded = addMeasurements(0.90f, 0.90f, 0.90f, 0, 500, app1, tester.nodeRepository());
        tester.clock().advance(timeAdded.negated());
        addMeasurements(0.99f, 0.99f, 0.99f, 0, 500, app2, tester.nodeRepository());

        ScalingSuggestionsMaintainer maintainer = new ScalingSuggestionsMaintainer(tester.nodeRepository(),
                                                                                   Duration.ofMinutes(1),
                                                                                   new TestMetric());
        maintainer.maintain();

        assertEquals("8 nodes with [vcpu: 3.3, memory: 4.0 Gb, disk: 10.0 Gb, bandwidth: 0.1 Gbps, architecture: any]",
                     suggestionOf(app1, cluster1, tester).resources().get().toString());
        assertEquals("7 nodes with [vcpu: 4.4, memory: 5.3 Gb, disk: 16.5 Gb, bandwidth: 0.1 Gbps, architecture: any]",
                     suggestionOf(app2, cluster2, tester).resources().get().toString());

        // Secondary suggestions
        assertEquals("9 nodes with [vcpu: 2.9, memory: 4.0 Gb, disk: 10.0 Gb, bandwidth: 0.1 Gbps, architecture: any]",
                suggestionsOf(app1, cluster1, tester).get(1).resources().get().toString());
        assertEquals("8 nodes with [vcpu: 3.8, memory: 4.7 Gb, disk: 14.2 Gb, bandwidth: 0.1 Gbps, architecture: any]",
                suggestionsOf(app2, cluster2, tester).get(1).resources().get().toString());

        // Utilization goes way down
        tester.clock().advance(Duration.ofHours(13));
        addMeasurements(0.10f, 0.10f, 0.10f, 0, 500, app1, tester.nodeRepository());
        maintainer.maintain();
        assertEquals("Suggestion stays at the peak value observed",
                     "8 nodes with [vcpu: 3.3, memory: 4.0 Gb, disk: 10.0 Gb, bandwidth: 0.1 Gbps, architecture: any]",
                     suggestionOf(app1, cluster1, tester).resources().get().toString());
        // Utilization is still way down and a week has passed
        tester.clock().advance(Duration.ofDays(7));
        addMeasurements(0.10f, 0.10f, 0.10f, 0, 500, app1, tester.nodeRepository());
        maintainer.maintain();
        assertEquals("Peak suggestion has been  outdated",
                     "3 nodes with [vcpu: 1.3, memory: 4.0 Gb, disk: 10.0 Gb, bandwidth: 0.1 Gbps, architecture: any]",
                     suggestionOf(app1, cluster1, tester).resources().get().toString());
        assertTrue(shouldSuggest(app1, cluster1, tester));

        tester.clock().advance(Duration.ofDays(3));
        addMeasurements(0.7f, 0.7f, 0.7f, 0, 500, app1, tester.nodeRepository());
        maintainer.maintain();
        var suggested = tester.nodeRepository().applications().get(app1).get().cluster(cluster1.id()).get().suggestions().stream().findFirst().flatMap(Autoscaling::resources).get();
        tester.deploy(app1, cluster1, Capacity.from(suggested, suggested,
                                                    IntRange.empty(), false, true, Optional.empty(), ClusterInfo.empty()));
        tester.clock().advance(Duration.ofDays(2));
        addMeasurements(0.2f, 0.65f, 0.6f,
                        0, 500, app1, tester.nodeRepository());
        maintainer.maintain();
        assertEquals("Suggestion is to keep the current allocation",
                     suggested,
                     suggestionOf(app1, cluster1, tester).resources().get());
        assertFalse("Suggestion is not made as it matches what we have", shouldSuggest(app1, cluster1, tester));
    }