File: config.feature

package info (click to toggle)
golang-github-crc-org-crc 2.34.0%2Bds1-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,548 kB
  • sloc: sh: 398; makefile: 326; javascript: 40
file content (154 lines) | stat: -rw-r--r-- 7,841 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
@config
Feature: Test configuration settings

    User checks whether CRC `config set` command works as expected
    in conjunction with `crc setup` and `crc start` commands.

    # SETTINGS

    Scenario Outline: CRC config checks (settings)
        When setting config property "<property>" to value "<value1>" succeeds
        Then file "crc.json" exists in CRC home folder
        And "JSON" config file "crc.json" in CRC home folder contains key "<property>" with value matching "<value1>"
        And setting config property "<property>" to value "<value2>" fails
        When unsetting config property "<property>" succeeds
        Then "JSON" config file "crc.json" in CRC home folder does not contain key "<property>"

        # always return to default values
        @darwin
        Examples: Config settings on Mac
            | property         | value1    | value2            |
            | cpus             | 5         | 3                 |
            | memory           | 9217      | 4096              |
            | nameserver       | 120.0.0.1 | 999.999.999.999   |
            | pull-secret-file | /etc      | /nonexistent-file |

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

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

    @linux @darwin @windows
    Scenario: CRC config checks (bundle version)
        Given executing single crc setup command succeeds
        When setting config property "bundle" to value "current bundle" succeeds
        And "JSON" config file "crc.json" in CRC home folder contains key "bundle" with value matching "current bundle"
        And setting config property "bundle" to value "/path/to/nonexistent/bundle/crc_hypervisor_version.tar.xz" fails
        When unsetting config property "bundle" succeeds
        Then "JSON" config file "crc.json" in CRC home folder does not contain key "bundle"


    @linux @darwin @windows
    Scenario: CRC config checks (update check)
        When setting config property "disable-update-check" to value "true" succeeds
        Then  "JSON" config file "crc.json" in CRC home folder contains key "disable-update-check" with value matching "true"
        When setting config property "disable-update-check" to value "false" succeeds
        Then "JSON" config file "crc.json" in CRC home folder does not contain key "disable-update-check"

    # SKIP

    Scenario Outline: CRC config checks (skips)
        When setting config property "<property>" to value "<value1>" succeeds
        And "JSON" config file "crc.json" in CRC home folder contains key "<property>" with value matching "<value1>"
        When executing crc setup command succeeds
        Then stderr should contain "Skipping above check..."
        When setting config property "<property>" to value "<value2>" succeeds
        Then "JSON" config file "crc.json" in CRC home folder does not contain key "<property>"
        When executing crc setup command succeeds
        Then stderr should not contain "Skipping above check..."

        @darwin
        Examples:
            | property                    | value1 | value2 |
            | skip-check-bundle-extracted | true   | false  |
            | skip-check-vfkit-installed  | true   | false  |
            | skip-check-root-user        | true   | false  |

        @linux
        Examples:
            | property                             | value1 | value2 |
            | skip-check-bundle-extracted          | true   | false  |
            | skip-check-crc-network               | true   | false  |
            | skip-check-crc-network-active        | true   | false  |
            | skip-check-kvm-enabled               | true   | false  |
            | skip-check-libvirt-driver            | true   | false  |
            | skip-check-libvirt-installed         | true   | false  |
            | skip-check-libvirt-running           | true   | false  |
            | skip-check-libvirt-version           | true   | false  |
            | skip-check-network-manager-installed | true   | false  |
            | skip-check-network-manager-running   | true   | false  |
            | skip-check-root-user                 | true   | false  |
            | skip-check-user-in-libvirt-group     | true   | false  |
            | skip-check-virt-enabled              | true   | false  |

        @windows
        Examples:
            | property                                             | value1 | value2 |
            | skip-check-bundle-extracted                          | true   | false  |
            | skip-check-user-in-crc-users-and-hyperv-admins-group | true   | false  |

    #| skip-check-hyperv-installed     | true   | false  |
    #| skip-check-hyperv-switch        | true   | false  |
    #| skip-check-administrator-user   | true   | false  |
    #| skip-check-windows-version      | true   | false  |

    # --------------------------------------
    # Linux-specific Scenarios

    @linux
    Scenario: Missing CRC setup
        Given executing single crc setup command succeeds
        When executing "rm ~/.crc/bin/crc-driver-libvirt" succeeds
        Then starting CRC with default bundle fails
        And stderr should contain "Preflight checks failed during `crc start`, please try to run `crc setup` first in case you haven't done so yet"

    @linux
    Scenario: Check network setup and destroy it, then check again
        When removing file "crc.json" from CRC home folder succeeds
        And executing single crc setup command succeeds
        And executing "sudo virsh net-list --name" succeeds
        Then stdout contains "crc"
        When executing "sudo virsh net-undefine crc && sudo virsh net-destroy crc" succeeds
        And executing "sudo virsh net-list --name" succeeds
        Then stdout should not contain "crc"

    @linux
    Scenario: Running `crc setup` with checks enabled restores destroyed network
        When setting config property "skip-check-crc-network" to value "false" succeeds
        And setting config property "skip-check-crc-network-active" to value "false" succeeds
        Then executing single crc setup command succeeds
        And executing "sudo virsh net-list --name" succeeds
        And stdout contains "crc"

    @linux
    Scenario: Running `crc start` without `crc setup` and with checks disabled fails when network destroyed
        # Destroy network again
        When executing "sudo virsh net-undefine crc && sudo virsh net-destroy crc" succeeds
        And executing "sudo virsh net-list --name" succeeds
        Then stdout should not contain "crc"
        # Disable checks
        When setting config property "skip-check-crc-network" to value "true" succeeds
        And setting config property "skip-check-crc-network-active" to value "true" succeeds

        # Start CRC
        Then starting CRC with default bundle fails
        And stderr contains "Network not found: no network with matching name 'crc'"

    @linux
    Scenario: Clean-up
        # Remove the config file
        When removing file "crc.json" from CRC home folder succeeds
        And executing crc setup command succeeds
        Then stderr should not contain "Skipping above check"