This guide provides a detailed step-by-step approach to running tests for the Cilium project. This is aimed at expert developers with a sound understanding of the project’s ecosystem.

Prerequisites

Before running tests, ensure you have the following installed:

  • Node.js (version 14.x or higher is recommended)
  • npm (comes with Node.js)
  • Access to a Kubernetes cluster (GKE or local setup)

Ensure your environment is properly configured for test execution, especially for end-to-end tests.

Step-by-Step Guide for Running Tests

Step 1: Clone the Repository

Begin by cloning the Cilium repository to your local machine.

git clone https://github.com/cilium/cilium.git
cd cilium

Step 2: Install Dependencies

Once you have cloned the repository, navigate to the root directory of the project and install the necessary dependencies.

npm install

Step 3: Start the Application

Before running tests, make sure the application is running. Use the following command to start Cilium:

npm run start

This command will start the application in development mode, setting the stage for executing tests.

Step 4: Running Tests

Cilium supports running tests in Kubernetes environments, specifically on managed services like GKE.

  1. Run End-to-End Tests: If you want to execute the complete test suite designed to run in a Kubernetes cluster:

    npm run test:e2e
    

    This command will initiate the end-to-end tests, which are beneficial for validating the overall functionality of Cilium within a Kubernetes context.

  2. Run Selected Tests: In scenarios where you want to focus on specific test cases, you can execute only the selected tests by specifying test patterns. For example:

    npm run test:e2e -- --grep "specific test pattern"
    

    This approach makes it easier to isolate and debug certain functionalities without running the entire test suite.

Step 5: Monitor Test Output

As the tests execute, observe the terminal for output logs that detail the outcome of each test. Successful tests will provide a summary, while failures will indicate what went wrong, offering insights into the problematic areas.

Notes on Test Environment

Running tests, especially end-to-end tests in Kubernetes, may require you to manage specific configurations related to the cluster. For instance, ensure that your Kubernetes context is set correctly for accessing the cluster. Refer to appropriate Cilium documentation for details on cluster management strategies.

Conclusion

By following the above steps, contributors and developers can effectively execute tests for the Cilium project, ensuring that all features work as intended. Regular testing aligns with the practice of test-driven development and contributes to the overall health of the project.

For further reference, consult the Cilium documentation and existing source files for any updates or additional instructions pertaining to the testing framework.

Source: README.md, src/posts/2020-02-18-cilium-17/index.md