github.com/SUSE/skuba@v1.4.17/ci/infra/testrunner/tests/test_upgrade_plan_from_previous.py (about)

     1  import pytest
     2  
     3  from tests.utils import PREVIOUS_VERSION, CURRENT_VERSION
     4  
     5  
     6  @pytest.mark.disruptive
     7  def test_upgrade_plan_from_previous(deployment, skuba, kubectl, platform):
     8      """
     9      Starting from an outdated cluster, check what cluster/node plan report.
    10      """
    11  
    12      # cluster upgrade plan
    13      out = skuba.cluster_upgrade_plan()
    14      assert out.find("Current Kubernetes cluster version: {pv}".format(
    15          pv=PREVIOUS_VERSION)) != -1
    16      assert out.find("Latest Kubernetes version: {cv}".format(
    17          cv=CURRENT_VERSION)) != -1
    18      assert out.find(
    19          "Upgrade path to update from {pv} to {cv}:\n  - {pv} -> {cv}".format(
    20              pv=PREVIOUS_VERSION, cv=CURRENT_VERSION)
    21      ) != -1
    22  
    23      # node upgrade plan
    24      masters = platform.get_num_nodes("master")
    25      for n in range(0, masters):
    26          master = skuba.node_upgrade("plan", "master", n)
    27          assert master.find(
    28              "Current Kubernetes cluster version: {pv}".format(pv=PREVIOUS_VERSION))
    29          assert master.find("Latest Kubernetes version: {cv}".format(
    30              cv=CURRENT_VERSION)) != -1
    31          assert master.find(" - apiserver: {pv} -> {cv}".format(
    32              pv=PREVIOUS_VERSION, cv=CURRENT_VERSION)) != -1
    33          assert master.find(" - kubelet: {pv} -> {cv}".format(
    34              pv=PREVIOUS_VERSION, cv=CURRENT_VERSION)) != -1
    35  
    36      workers = platform.get_num_nodes("worker")
    37      worker_names = platform.get_nodes_names("worker")
    38      for n in range(0, workers):
    39          worker = skuba.node_upgrade("plan", "worker", n, ignore_errors=True)
    40          # If the control plane nodes are not upgraded yet, skuba disallows upgrading a worker
    41          assert worker.find("Unable to plan node upgrade: {} is not upgradeable until all control plane nodes are upgraded".format(worker_names[n]))