-
Git
-
Make
-
A recent Go distribution (>=1.11)
|
Note
|
You should be able to develop the project on Linux, Windows, or macOS. |
Get the sources from GitHub:
$ git clone https://github.com/crc-org/crc.git
|
Note
|
Do not keep the source code in your |
CRC uses Go modules for dependency management.
For more information, see the following:
In order to compile the crc executable for your local platform, run the following command:
$ make
By default, the above command will place the crc executable in the $GOBIN path.
Run the following command to cross-compile the crc executable for many platforms:
$ make cross
Note: This command will output the cross-compiled crc executable(s) in the out directory by default:
$ tree out/
out/
├── linux-amd64
│ └── crc
├── macos-amd64
│ └── crc
└── windows-amd64
└── crc.exe
To run all unit test use:
$ make testIf you need to update mocks use:
$ make generate_mocksWe have automated e2e tests which keep CRC in shape.
End-to-end (e2e) tests borrow code from Clicumber package to provide basic functionality for testing CLI binaries. This facilitates running commands in a persistent shell instance (bash, tcsh, zsh, Command Prompt, or PowerShell), assert its outputs (standard output, standard error, or exit code), check configuration files, and so on. The general functionality of Clicumber is then extended by CRC specific test code to cover the whole functionality of CRC.
First, one needs to set the following flags in Makefile, under e2e target:
-
--pull-secret-file: absolute path to your OpenShift pull secret. -
--bundle-location: if bundle is embedded, this flag should be set to--bundle-location=embeddedor not passed at all; if bundle is not embedded, then absolute path to the bundle should be passed. -
--crc-binary: ifcrcbinary resides in$GOPATH/bin, then this flag needs not be passed; otherwise absolute path to thecrcbinary should be passed.
To start e2e tests, run:
$ make e2eImplicitly, all e2e tests for your operating system are executed. If you want to run only tests from one feature file, you have to override GODOG_OPTS environment variable. For example:
make e2e GODOG_OPTS="--godog.tags='@basic && @windows'" BUNDLE_LOCATION=<bundle location> PULL_SECRET_FILE=<pull secret path>Please notice @basic && @windows, where @basic tag stands for basic.feature file and @windows tag for e2e tests designed for Windows.
On linux platform first stop the network time sync using:
$ sudo timedatectl set-ntp offSet the time 2 month ahead:
$ sudo date -s '2 month'Start the crc with CRC_DEBUG_ENABLE_STOP_NTP=true set:
$ CRC_DEBUG_ENABLE_STOP_NTP=true crc start