Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

disk: cover all entities in PartitionTable.features() #1074

Merged
merged 3 commits into from
Nov 29, 2024

Commits on Nov 29, 2024

  1. disk: cover all entities in PartitionTable.features()

    Add a case for every entity type in the PartitionTable.features()
    callback.  More importantly, panic if any entity type is not covered by
    a case.  This ensures that when a new entity type is added, we need to
    consider whether it needs to be represented as a feature, added to an
    existing one, or ignored.
    
    Co-authored-by: Michael Vogt <[email protected]>
    achilleas-k and mvo5 committed Nov 29, 2024
    Configuration menu
    Copy the full SHA
    a47fae0 View commit details
    Browse the repository at this point in the history
  2. disk,osbuild: use t.Name() in test update instruction message

    Use t.Name() in the tests that use the TestPartitionTables and expect
    all cases to be covered so that we don't need to keep the message in
    sync with the function name.
    
    The message for TestForEachFSTabEntity() was wrong.
    achilleas-k committed Nov 29, 2024
    Configuration menu
    Copy the full SHA
    5974c14 View commit details
    Browse the repository at this point in the history
  3. disk: update TestPartitionTableFeatures() to catch missing test case

    Update the TestPartitionTableFeatures() to match other tests that use
    the TestPartitionTables.
    
    - Switch to require from assert to stop test execution if something
      fails.  This makes it easier to see the important error message.  With
      assert, execution would continue when `ok` is false, which would make
      the assert.Equal() test print an error too (exp would be an empty
      initialised struct of PartitionTableFeatures) and can make it hard to
      notice that the "expected test result not defined" error was printed
      first.
    - Use a map for testCases so we can get each test case by name (the
      order is not important).
    - Print the same error message as the other similar tests, using
      t.Name() to refer to the test function name.
    - Add plain-noboot test case, which was missing from the test.
    achilleas-k committed Nov 29, 2024
    Configuration menu
    Copy the full SHA
    db5fec0 View commit details
    Browse the repository at this point in the history