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

Feature: Coexistence with user-defined states | Scenario: Create a user-defined state | Scenario: Trigger highstate from API | Scenario: Cleanup: remove user-defined state and the file it created #9381

Conversation

szachovy
Copy link
Contributor

@szachovy szachovy commented Oct 17, 2024

What does this PR change?

It has too little privileges to be applied in the following scenarios. This state were omitted:

uyuni-server:/srv/salt # tail -f /var/log/salt/master
    return callable(*args, **kwargs)
  File "/usr/lib/python3.6/site-packages/salt/loader/lazy.py", line 1249, in _run_as
    ret = _func_or_method(*args, **kwargs)
  File "/usr/lib/python3.6/site-packages/salt/fileserver/roots.py", line 305, in file_hash
    ret["hsum"] = salt.utils.hashutils.get_hash(path, __opts__["hash_type"])
  File "/usr/lib/python3.6/site-packages/salt/utils/hashutils.py", line 165, in get_hash
    with salt.utils.files.fopen(path, "rb") as ifile:
  File "/usr/lib/python3.6/site-packages/salt/utils/files.py", line 393, in fopen
    f_handle = open(*args, **kwargs)  # pylint: disable=resource-leakage
PermissionError: [Errno 13] Permission denied: '/srv/salt/top.sls'
...
uyuni-server:/srv/salt # ls -la
total 8
drwxr-xr-x. 1 root salt  58 Oct 17 12:21 .
drwxr-xr-x. 1 root root 172 Oct 15 16:23 ..
-rw-------. 1 root salt  77 Oct 17 12:21 top.sls
-rw-r--r--. 1 root salt 148 Oct 17 12:21 user_defined_state.sls

The following changes makes features/secondary/min_salt_user_states.feature passing:

uyuni-master-podman-ctl:~/spacewalk/testsuite # cucumber features/secondary/min_salt_user_states.feature 
Using Ruby version: 3.3.5
Capybara APP Host: https://uyuni-master-podman-srv.mgr.suse.de:8888
Initializing a remote node for 'server'.
Host 'server' is alive with determined hostname uyuni-master-podman-srv and FQDN uyuni-master-podman-srv.mgr.suse.de
Node: uyuni-master-podman-srv, OS Version: 15.6, Family: opensuse-leap
Activating HTTP API
Using the default profile...
# Copyright (c) 2018-2024 SUSE LLC
# Licensed under the terms of the MIT license.
@skip_if_github_validation @scope_salt
Feature: Coexistence with user-defined states

  Scenario: Log in as org admin user # features/secondary/min_salt_user_states.feature:8
      This scenario ran at: 2024-10-17 12:54:19 +0200
    Given I am authorized            # features/step_definitions/navigation_steps.rb:562
      This scenario took: 13 seconds

  Scenario: Create a user-defined state                                                      # features/secondary/min_salt_user_states.feature:11
      This scenario ran at: 2024-10-17 12:54:32 +0200
Initializing a remote node for 'sle_minion'.
Host 'sle_minion' is alive with determined hostname uyuni-master-podman-min-suse and FQDN uyuni-master-podman-min-suse.mgr.suse.de
Node: uyuni-master-podman-min-suse, OS Version: 15.5, Family: opensuse-leap
    Given I am on the Systems overview page of this "sle_minion"                             # features/step_definitions/navigation_steps.rb:432
    When I follow "States" in the content area                                               # features/step_definitions/navigation_steps.rb:314
Initializing a remote node for 'localhost'.
Host 'localhost' is alive with determined hostname uyuni-master-podman-ctl and FQDN uyuni-master-podman-ctl.mgr.suse.de
Node: uyuni-master-podman-ctl, OS Version: 15.5, Family: opensuse-leap
    And I install a user-defined state for "sle_minion" on the server                        # features/step_definitions/command_steps.rb:621
    And I follow "Highstate" in the content area                                             # features/step_definitions/navigation_steps.rb:314
    And I click on "Show full highstate output"                                              # features/step_definitions/navigation_steps.rb:260
    And I wait for "6" seconds                                                               # features/step_definitions/common_steps.rb:19
    Then I should see a "user_defined_state" or "running as PID" text in element "highstate" # features/step_definitions/navigation_steps.rb:710
      This scenario took: 11 seconds

  Scenario: Trigger highstate from API                                    # features/secondary/min_salt_user_states.feature:20
      This scenario ran at: 2024-10-17 12:54:43 +0200
    When I schedule a highstate for "sle_minion" via API                  # features/step_definitions/api_common.rb:46
    And I wait until event "Apply highstate scheduled" is completed       # features/step_definitions/common_steps.rb:164
    Then file "/tmp/test_user_defined_state" should exist on "sle_minion" # features/step_definitions/file_management_steps.rb:26
      This scenario took: 22 seconds

  Scenario: Cleanup: remove user-defined state and the file it created       # features/secondary/min_salt_user_states.feature:25
      This scenario ran at: 2024-10-17 12:55:05 +0200
    When I follow "States" in the content area                               # features/step_definitions/navigation_steps.rb:314
    And I uninstall the user-defined state from the server                   # features/step_definitions/command_steps.rb:645
    And I uninstall the managed file from "sle_minion"                       # features/step_definitions/command_steps.rb:649
    And I follow "Highstate" in the content area                             # features/step_definitions/navigation_steps.rb:314
    And I click on "Show full highstate output"                              # features/step_definitions/navigation_steps.rb:260
    And I wait for "6" seconds                                               # features/step_definitions/common_steps.rb:19
    Then I should not see a "user_defined_state" text in element "highstate" # features/step_definitions/navigation_steps.rb:704
      This scenario took: 18 seconds

4 scenarios (4 passed)
18 steps (18 passed)
1m3.943s

GUI diff

No difference.

  • DONE

Documentation

  • No documentation needed: only internal and user invisible changes

  • DONE

Test coverage

  • No tests: already covered

  • DONE

Links

Issue(s): https://github.com/SUSE/spacewalk/issues/25559
Port(s): https://github.com/SUSE/spacewalk/pull/25560

  • DONE

Changelogs

Make sure the changelogs entries you are adding are compliant with https://github.com/uyuni-project/uyuni/wiki/Contributing#changelogs and https://github.com/uyuni-project/uyuni/wiki/Contributing#uyuni-projectuyuni-repository

If you don't need a changelog check, please mark this checkbox:

  • No changelog needed

If you uncheck the checkbox after the PR is created, you will need to re-run changelog_test (see below)

Re-run a test

If you need to re-run a test, please mark the related checkbox, it will be unchecked automatically once it has re-run:

  • Re-run test "changelog_test"
  • Re-run test "backend_unittests_pgsql"
  • Re-run test "java_pgsql_tests"
  • Re-run test "schema_migration_test_pgsql"
  • Re-run test "susemanager_unittests"
  • Re-run test "javascript_lint"
  • Re-run test "spacecmd_unittests"

Before you merge

Check How to branch and merge properly!

@szachovy szachovy requested a review from a team as a code owner October 17, 2024 11:07
Copy link
Contributor

👋 Hello! Thanks for contributing to our project.
Acceptance tests will take some time (aprox. 1h), please be patient ☕
You can see the progress at the end of this page and at https://github.com/uyuni-project/uyuni/pull/9381/checks
Once tests finish, if they fail, you can check 👀 the cucumber report. See the link at the output of the action.
You can also check the artifacts section, which contains the logs at https://github.com/uyuni-project/uyuni/pull/9381/checks.

If you are unsure the failing tests are related to your code, you can check the "reference jobs". These are jobs that run on a scheduled time with code from master. If they fail for the same reason as your build, it means the tests or the infrastructure are broken. If they do not fail, but yours do, it means it is related to your code.

Reference tests:

KNOWN ISSUES

Sometimes the build can fail when pulling new jar files from download.opensuse.org . This is a known limitation. Given this happens rarely, when it does, all you need to do is rerun the test. Sorry for the inconvenience.

For more tips on troubleshooting, see the troubleshooting guide.

Happy hacking!
⚠️ You should not merge if acceptance tests fail to pass. ⚠️

Copy link
Contributor

@Bischoff Bischoff left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not a big fan of octal notation for chmod, it's not very legible, but ok.

@szachovy szachovy added the merge-candidate Meaning it needs to be considered for merging when the master branch is frozen label Oct 22, 2024
@szachovy
Copy link
Contributor Author

Pending java_pgsql_tests are green with https://ci.suse.de/job/uyuni-prs-java_pgsql_tests-pipeline/72933/, don't know why the status does not update here. Merging

@szachovy szachovy merged commit 16d04c3 into uyuni-project:master Oct 23, 2024
15 of 16 checks passed
@szachovy szachovy deleted the 25559-feature-coexistence-with-user-defined-states-|-scenario-create-a-user-defined-state-|-scenario-trigger-highstate-from-api-|-scenario-cleanup-remove-user-defined-state-and-the-file-it-created branch October 23, 2024 08:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merge-candidate Meaning it needs to be considered for merging when the master branch is frozen ruby_rubocop test-framework testing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants