Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AG-22 - Add Agent Tests #58

Open
wants to merge 26 commits into
base: master
Choose a base branch
from
Open

AG-22 - Add Agent Tests #58

wants to merge 26 commits into from

Commits on Sep 22, 2023

  1. ```

    Add tests for NewHeartbeat and Update functions
    ```
    
    This commit adds tests for the `NewHeartbeat` and `Update` functions in the `agent` package. The `NewHeartbeat` test checks if the `NewHeartbeat` function correctly initializes a new heartbeat with the given name, service type, and interval. It also verifies the initial status and info of the heartbeat.
    
    Signed-off-by: SammyOina <[email protected]>
    SammyOina committed Sep 22, 2023
    Configuration menu
    Copy the full SHA
    e427739 View commit details
    Browse the repository at this point in the history
  2. extract constants

    Signed-off-by: SammyOina <[email protected]>
    SammyOina committed Sep 22, 2023
    Configuration menu
    Copy the full SHA
    1760a96 View commit details
    Browse the repository at this point in the history
  3. Add bootstrap tests.

    Fix error when writing to TOML file
    
    The commit fixes an error that occurs when writing to a TOML file.
    The error is wrapped with a custom error message.
    This ensures that the error is properly handled and provides more
    context to the developer.
    
    The commit also includes changes to the import statements in the
    bootstrap.go file.
    
    Signed-off-by: SammyOina <[email protected]>
    SammyOina committed Sep 22, 2023
    Configuration menu
    Copy the full SHA
    98d44f3 View commit details
    Browse the repository at this point in the history
  4. Fix error handling in bootstrap_test.go

    The commit fixes error handling in the bootstrap_test.go file by checking for an error when writing the response body. This ensures that any errors are properly handled and reported.
    
    Signed-off-by: SammyOina <[email protected]>
    SammyOina committed Sep 22, 2023
    Configuration menu
    Copy the full SHA
    2c00958 View commit details
    Browse the repository at this point in the history
  5. Fix context bug in NewHeartbeat function to allow graceful stop to li…

    …sten function
    
    Signed-off-by: SammyOina <[email protected]>
    SammyOina committed Sep 22, 2023
    Configuration menu
    Copy the full SHA
    d6c94d4 View commit details
    Browse the repository at this point in the history
  6. Fix race condition in Heartbeat.Info() method

    The `Info()` method in the `Heartbeat` interface was not thread-safe,
    which could lead to a race condition when accessing the `info` field.
    To fix this issue, a mutex was added to protect the access to `info`
    and ensure thread safety. The `Info()` method now locks the mutex
    before accessing `info` and unlocks it before returning the value.
    Additionally, a new `Close()` method was added to stop the heartbeat
    ticker when it is no longer needed.
    
    Signed-off-by: SammyOina <[email protected]>
    SammyOina committed Sep 22, 2023
    Configuration menu
    Copy the full SHA
    5173159 View commit details
    Browse the repository at this point in the history
  7. Fix error handling in agent/config.go

    The commit fixes error handling in agent/config.go
    by adding more specific error variables and updating
    the error messages. This improves the clarity and
    readability of the codebase.
    
    Signed-off-by: SammyOina <[email protected]>
    SammyOina committed Sep 22, 2023
    Configuration menu
    Copy the full SHA
    54eb0c4 View commit details
    Browse the repository at this point in the history

Commits on Sep 26, 2023

  1. test ci

    Signed-off-by: SammyOina <[email protected]>
    SammyOina committed Sep 26, 2023
    Configuration menu
    Copy the full SHA
    bc62713 View commit details
    Browse the repository at this point in the history
  2. test push

    Signed-off-by: SammyOina <[email protected]>
    SammyOina committed Sep 26, 2023
    Configuration menu
    Copy the full SHA
    37454e2 View commit details
    Browse the repository at this point in the history
  3. test 22

    Signed-off-by: SammyOina <[email protected]>
    SammyOina committed Sep 26, 2023
    Configuration menu
    Copy the full SHA
    3e128d3 View commit details
    Browse the repository at this point in the history
  4. test target

    Signed-off-by: SammyOina <[email protected]>
    SammyOina committed Sep 26, 2023
    Configuration menu
    Copy the full SHA
    389cf39 View commit details
    Browse the repository at this point in the history
  5. switch context

    Signed-off-by: SammyOina <[email protected]>
    SammyOina committed Sep 26, 2023
    Configuration menu
    Copy the full SHA
    cb91759 View commit details
    Browse the repository at this point in the history
  6. switch context

    Signed-off-by: SammyOina <[email protected]>
    SammyOina committed Sep 26, 2023
    Configuration menu
    Copy the full SHA
    9319d04 View commit details
    Browse the repository at this point in the history
  7. make agent

    Signed-off-by: SammyOina <[email protected]>
    SammyOina committed Sep 26, 2023
    Configuration menu
    Copy the full SHA
    8ed7430 View commit details
    Browse the repository at this point in the history
  8. debug build

    Signed-off-by: SammyOina <[email protected]>
    SammyOina committed Sep 26, 2023
    Configuration menu
    Copy the full SHA
    23fca33 View commit details
    Browse the repository at this point in the history
  9. build args

    Signed-off-by: SammyOina <[email protected]>
    SammyOina committed Sep 26, 2023
    Configuration menu
    Copy the full SHA
    3577f0e View commit details
    Browse the repository at this point in the history

Commits on Sep 28, 2023

  1. Add terminal tests

    Refactor build workflow
    
    The build22.yml file has been deleted. This commit removes the build22.yml file, which was used to create and publish a Docker image. The file is no longer needed as it is no longer being used in the project.
    
    Signed-off-by: SammyOina <[email protected]>
    SammyOina committed Sep 28, 2023
    Configuration menu
    Copy the full SHA
    37ccb04 View commit details
    Browse the repository at this point in the history
  2. Add test for PushOperation function in edgex package

    This commit adds a new test for the PushOperation function in the edgex package. The test creates a mock HTTP server and checks the HTTP request method, URL, and request body. The test ensures that the function correctly handles the POST request with the expected URL and request body.
    
    Signed-off-by: SammyOina <[email protected]>
    SammyOina committed Sep 28, 2023
    Configuration menu
    Copy the full SHA
    2dc7996 View commit details
    Browse the repository at this point in the history
  3. Add tests for the conn package

    This commit adds tests for the conn package. The tests cover various scenarios and ensure the functionality of the package is working as expected.
    
    Signed-off-by: SammyOina <[email protected]>
    SammyOina committed Sep 28, 2023
    Configuration menu
    Copy the full SHA
    400dbb1 View commit details
    Browse the repository at this point in the history
  4. Fix bug in client_test.go

    The commit fixes a bug in the client_test.go file where the expected response was not being properly set. The bug caused the test to fail. The fix ensures that the expected response is correctly set and the test passes as expected.
    
    Signed-off-by: SammyOina <[email protected]>
    SammyOina committed Sep 28, 2023
    Configuration menu
    Copy the full SHA
    4a4b4ec View commit details
    Browse the repository at this point in the history
  5. Fix error handling in main.go and endpoints_test.go

    The commit fixes error handling in main.go and endpoints_test.go.
    It ensures that the server is properly shutdown and logs any errors
    that occur during the shutdown process.
    
    Signed-off-by: SammyOina <[email protected]>
    SammyOina committed Sep 28, 2023
    Configuration menu
    Copy the full SHA
    09b6fc1 View commit details
    Browse the repository at this point in the history
  6. remove test.yml

    Signed-off-by: SammyOina <[email protected]>
    SammyOina committed Sep 28, 2023
    Configuration menu
    Copy the full SHA
    397d40e View commit details
    Browse the repository at this point in the history
  7. Fix Docker image tag and file path in Makefile and Dockerfile

    The Docker image tag and file path in the Makefile and Dockerfile have been fixed to use the correct repository name "Mainflux" instead of "sammyoina". This ensures that the Docker images are tagged and pushed to the correct repository. Additionally, the file path in the Dockerfile has been updated to correctly move the built executable to the desired location.
    
    Signed-off-by: SammyOina <[email protected]>
    SammyOina committed Sep 28, 2023
    Configuration menu
    Copy the full SHA
    e667a83 View commit details
    Browse the repository at this point in the history
  8. remove comment

    Signed-off-by: SammyOina <[email protected]>
    SammyOina committed Sep 28, 2023
    Configuration menu
    Copy the full SHA
    dcee54f View commit details
    Browse the repository at this point in the history
  9. Fix Docker image tag in Makefile

    The Docker image tag in the Makefile was updated to use lowercase "mainflux" instead of "Mainflux". This ensures consistency with the naming convention used for the Docker images.
    
    Signed-off-by: SammyOina <[email protected]>
    SammyOina committed Sep 28, 2023
    Configuration menu
    Copy the full SHA
    3cd4521 View commit details
    Browse the repository at this point in the history

Commits on Oct 18, 2023

  1. add test cases and format string

    Signed-off-by: SammyOina <[email protected]>
    SammyOina committed Oct 18, 2023
    Configuration menu
    Copy the full SHA
    acc18bb View commit details
    Browse the repository at this point in the history