Skip to content

Commit

Permalink
test (e2e) : add e2e test for developer-password config option
Browse files Browse the repository at this point in the history
+ Add additional assertions in basic test to verify that when no developer password is configured,
  then "developer" value is used for password
+ Add custom_developer_password e2e test to verify that when custom developer-password configuration
  option is provided, then that custom value is used as developer password

Signed-off-by: Rohan Kumar <[email protected]>
  • Loading branch information
rohanKanojia committed Jan 10, 2025
1 parent 7fe3ca0 commit 42b0580
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 18 deletions.
6 changes: 6 additions & 0 deletions test/e2e/features/basic.feature
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,18 @@ Feature: Basic test
@darwin @linux @windows @cleanup
Scenario: CRC start usecase
Given executing "crc setup --check-only" fails
And unsetting config property "developer-password" succeeds
# Request start with monitoring stack
* setting config property "enable-cluster-monitoring" to value "true" succeeds
* setting config property "memory" to value "16000" succeeds
Given executing single crc setup command succeeds
When starting CRC with default bundle succeeds
Then stdout should contain "Started the OpenShift cluster"
And stdout should contain "Log in as administrator:"
And stdout should contain " Username: kubeadmin"
And stdout should contain "Log in as user:"
And stdout should contain " Username: developer"
And stdout should contain " Password: developer"
# Check if user can copy-paste login details for developer and kubeadmin users
* stdout should match "(?s)(.*)oc login -u developer https:\/\/api\.crc\.testing:6443(.*)$"
* stdout should match "(?s)(.*)https:\/\/console-openshift-console\.apps-crc\.testing(.*)$"
Expand Down
39 changes: 21 additions & 18 deletions test/e2e/features/config.feature
Original file line number Diff line number Diff line change
Expand Up @@ -17,27 +17,30 @@ Feature: Test configuration settings
# always return to default values
@darwin
Examples: Config settings on Mac
| property | value1 | value2 |
| cpus | 5 | 3 |
| memory | 10753 | 4096 |
| nameserver | 120.0.0.1 | 999.999.999.999 |
| pull-secret-file | /etc | /nonexistent-file |
| property | value1 | value2 |
| cpus | 5 | 3 |
| memory | 10753 | 4096 |
| nameserver | 120.0.0.1 | 999.999.999.999 |
| pull-secret-file | /etc | /nonexistent-file |
| developer-password | secret1 | secret2 |

@linux
Examples: Config settings on Linux
| property | value1 | value2 |
| cpus | 5 | 3 |
| memory | 10753 | 4096 |
| nameserver | 120.0.0.1 | 999.999.999.999 |
| pull-secret-file | /etc | /nonexistent-file |
| property | value1 | value2 |
| cpus | 5 | 3 |
| memory | 10753 | 4096 |
| nameserver | 120.0.0.1 | 999.999.999.999 |
| pull-secret-file | /etc | /nonexistent-file |
| developer-password | secret1 | secret2 |

@windows
Examples: Config settings on Windows
| property | value1 | value2 |
| cpus | 5 | 3 |
| memory | 10753 | 4096 |
| nameserver | 120.0.0.1 | 999.999.999.999 |
| pull-secret-file | /Users | /nonexistent-file |
| property | value1 | value2 |
| cpus | 5 | 3 |
| memory | 10753 | 4096 |
| nameserver | 120.0.0.1 | 999.999.999.999 |
| pull-secret-file | /Users | /nonexistent-file |
| developer-password | secret1 | secret2 |

@linux @darwin @windows
Scenario: CRC config checks (bundle version)
Expand Down Expand Up @@ -172,14 +175,14 @@ Feature: Test configuration settings
When unsetting config property "preset" succeeds
And stdout should contain "Successfully unset configuration property 'preset'"
And "JSON" config file "crc.json" in CRC home folder does not contain key "preset"
@linux @darwin @windows

@linux @darwin @windows
Examples: Config property preset setting positive
| preset-value |
| microshift |
| okd |

Scenario: CRC config set preset (negtive cases)
Scenario: CRC config set preset (negative cases)
When setting config property "preset" to value "<preset-value>" fails
And stderr should contain "reason: Unknown preset"

Expand Down
19 changes: 19 additions & 0 deletions test/e2e/features/custom_developer_password.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
@story_custom_developer_password
Feature: Custom Developer Password Test

User provides configuration property to override default developer user password

Background:
Given ensuring CRC cluster is running

@linux @windows @darwin @cleanup
Scenario: Override default developer password should be reflected during crc start
Given executing "crc stop" succeeds
And setting config property "developer-password" to value "secret-dev" succeeds
When starting CRC with default bundle succeeds
Then stdout should contain "Started the OpenShift cluster"
And stdout should contain "Log in as administrator:"
And stdout should contain " Username: kubeadmin"
And stdout should contain "Log in as user:"
And stdout should contain " Username: developer"
And stdout should contain " Password: secret-dev"

0 comments on commit 42b0580

Please sign in to comment.