Skip to content

Commit

Permalink
test (e2e) : Use Scenario outline to test various man pages
Browse files Browse the repository at this point in the history
Signed-off-by: Rohan Kumar <[email protected]>
  • Loading branch information
rohanKanojia committed Feb 14, 2025
1 parent df2b631 commit 6a26a73
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 32 deletions.
61 changes: 55 additions & 6 deletions test/e2e/features/manpages.feature
Original file line number Diff line number Diff line change
@@ -1,10 +1,59 @@
@story_manpages
Feature: Check generation and cleanup of manpages

@linux @darwin @cleanup
Scenario: verify man pages are generated after crc setup and deleted on cleanup
When executing single crc setup command succeeds
Then accessing crc man pages succeeds
Scenario: Setup CRC Cluster
Given executing single crc setup command succeeds

When executing crc cleanup command succeeds
Then accessing crc man pages fails
@linux @darwin
Scenario Outline: verify man pages are accessible after setup
Then executing "man -P cat <crc-subcommand>" succeeds

@linux @darwin
Examples: Man pages to check
| crc-subcommand |
| crc-bundle-generate |
| crc-config |
| crc-start |
| crc-bundle |
| crc-console |
| crc-status |
| crc-cleanup |
| crc-delete |
| crc-stop |
| crc-config-get |
| crc-ip |
| crc-version |
| crc-config-set |
| crc-oc-env |
| crc-config-unset |
| crc-podman-env |
| crc-config-view |
| crc-setup |

Scenario: Cleanup CRC Cluster
When executing crc cleanup command succeeds

Scenario Outline: verify man pages are NOT accessible after cleanup
Then executing "man -P cat <crc-subcommand>" fails

@linux @darwin
Examples: Man pages to check
| crc-subcommand |
| crc-bundle-generate |
| crc-config |
| crc-start |
| crc-bundle |
| crc-console |
| crc-status |
| crc-cleanup |
| crc-delete |
| crc-stop |
| crc-config-get |
| crc-ip |
| crc-version |
| crc-config-set |
| crc-oc-env |
| crc-config-unset |
| crc-podman-env |
| crc-config-view |
| crc-setup |
26 changes: 0 additions & 26 deletions test/e2e/testsuite/testsuite.go
Original file line number Diff line number Diff line change
Expand Up @@ -1076,32 +1076,6 @@ func EnsureKubeConfigIsCleanedUp() error {
return nil
}

func EnsureCRCManPagesAvailability(expectedStatus string) error {
expectedManFileList := []string{
"crc-bundle-generate.1.gz", "crc-config.1.gz", "crc-start.1.gz",
"crc-bundle.1.gz", "crc-console.1.gz", "crc-status.1.gz",
"crc-cleanup.1.gz", "crc-delete.1.gz", "crc-stop.1.gz",
"crc-config-get.1.gz", "crc-ip.1.gz", "crc-version.1.gz",
"crc-config-set.1.gz", "crc-oc-env.1.gz", "crc.1.gz",
"crc-config-unset.1.gz", "crc-podman-env.1.gz",
"crc-config-view.1.gz", "crc-setup.1.gz",
}
userHomeDir, err := os.UserHomeDir()
if err != nil {
return fmt.Errorf("failed to get user home directory: %v", err)
}
manPageDir := filepath.Join(userHomeDir, ".local", "share", "man", "man1")
for _, manPage := range expectedManFileList {
manFile := filepath.Join(manPageDir, manPage)
manCommand := fmt.Sprintf("man -P cat %s", manFile)
err := util.ExecuteCommandSucceedsOrFails(manCommand, expectedStatus)
if err != nil {
return err
}
}
return nil
}

// This function will wait until the microshift cluster got operational
func EnsureMicroshiftClusterIsOperational() error {
// First wait until crc report the cluster as running
Expand Down

0 comments on commit 6a26a73

Please sign in to comment.