291 Commits

Author SHA1 Message Date
Dušan Borovčanin 658003080e NOISSUE - Update Docker and Compose versions (#2159)
Signed-off-by: Dusan Borovcanin <borovcanindusan1@gmail.com>
2024-04-10 12:02:36 +02:00
Steve Munene ddb90a046a MG-2136 - Generate mocks with mockery for Bootstrap service (#2140)
Signed-off-by: nyagamunene <stevenyaga2014@gmail.com>
2024-04-09 11:48:45 +02:00
b1ackd0t 33704abc0c NOISSUE - Add property based testing to things service (#2088)
Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>
Signed-off-by: rodneyosodo <blackd0t@protonmail.com>
2024-04-09 10:09:14 +02:00
b1ackd0t eb6b201a2a NOISSUE - Fix Failing Users Property Based Tests (#2134)
Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>
2024-04-03 13:01:42 +02:00
Dušan Borovčanin a39d46238b NOISSUE - Fix links in README.md file (#2129)
Signed-off-by: Dusan Borovcanin <borovcanindusan1@gmail.com>
2024-04-03 11:55:06 +02:00
b1ackd0t 70c3d65863 NOISSUE - Add property based testing to users service (#2087)
Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>
2024-03-22 16:16:07 +01:00
b1ackd0t ec7b4b45ec NOISSUE - Convert SenML Payload Time To UnixNano (#2115)
Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>
Signed-off-by: rodneyosodo <blackd0t@protonmail.com>
2024-03-15 21:32:29 +01:00
b1ackd0t 22a3c2962d NOISSUE - Remove OAuth2.0 tokens from Magistrala token (#2106)
Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>
Signed-off-by: rodneyosodo <blackd0t@protonmail.com>
2024-03-14 14:55:17 +01:00
b1ackd0t fbec74bd94 NOISSUE - Add Secret Validation on Registration (#2109)
Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>
2024-03-13 13:11:20 +01:00
Nataly Musilah 42d433a92f NOISSUE - Update timescale reader (#2085)
Signed-off-by: Musilah <nataleigh.nk@gmail.com>
Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>
Co-authored-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>
2024-03-05 12:12:55 +01:00
b1ackd0t 0f05c10a38 MG-1887 - Add support for OAuth2.0 (#2103)
Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>
2024-03-01 10:51:34 +01:00
b1ackd0t adb03b4ed8 NOISSUE - Add Event Subscriber Config (#2054)
Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>
2024-02-26 16:42:08 +01:00
b1ackd0t 0ed79371a4 NOISSUE - Remove duplicate errors (#2086)
Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>
2024-02-21 14:31:11 +01:00
Arvindh 4c206ec375 NOISSUE - Fix Bootstrap thing creation flow (#2083)
Signed-off-by: Arvindh <arvindh91@gmail.com>
2024-02-19 16:03:21 +01:00
b1ackd0t e77d4eafc5 NOISSUE - Pin the version of golangci-lint (#2077)
Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>
2024-02-12 12:21:33 +01:00
Sammy Kerata Oina f938a0c28a NOISSUE - Replace deprecated gRPC metrics collection with stats handler (#281)
Signed-off-by: SammyOina <sammyoina@gmail.com>
2024-01-29 16:54:47 +01:00
Arvindh 2c4880485d MG-104: Rename/Replace filed owner with domain (#268)
Signed-off-by: Arvindh <arvindh91@gmail.com>
2024-01-27 22:47:00 +01:00
Arvindh e2616ecc4f NOISSUE - Fix messaging handler logger (#280)
Signed-off-by: Arvindh <arvindh91@gmail.com>
2024-01-26 18:09:34 +01:00
b1ackd0t 75b65afcbf NOISSUE - Make Check Interval Configurable (#277)
Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>
Signed-off-by: rodneyosodo <blackd0t@protonmail.com>
2024-01-25 16:02:13 +01:00
Felix Gateru 7a93e6a893 NOISSUE - Improve tests in Auth service (#262)
Signed-off-by: felix.gateru <felix.gateru@gmail.com>
2024-01-25 14:03:20 +01:00
Nataly Musilah 4a909a1ab2 MG-234 - Improve Logging Middleware (#272)
Signed-off-by: Musilah <nataleigh.nk@gmail.com>
2024-01-24 18:04:29 +01:00
Dušan Borovčanin 24d3804f89 NOISSUE - Revert Mosquitto broker version in MQTT tests (#2063)
Signed-off-by: Dusan Borovcanin <borovcanindusan1@gmail.com>
2024-01-24 13:43:56 +01:00
Dušan Borovčanin 79ef28a9ce NOISSUE - Update dependencies (#2061)
Signed-off-by: Dusan Borovcanin <borovcanindusan1@gmail.com>
2024-01-23 13:09:07 +01:00
Nataly Musilah 8c084b177e MG-234 - Improve Logging (#255)
Signed-off-by: Musilah <nataleigh.nk@gmail.co>
Signed-off-by: Musilah <nataleigh.nk@gmail.com>
Co-authored-by: Musilah <nataleigh.nk@gmail.co>
Co-authored-by: Dušan Borovčanin <dusan.borovcanin@abstractmachines.fr>
2024-01-18 15:28:04 +01:00
b1ackd0t 95f31d70a2 NOISSUE - Use methods for accessing in generated code (#204)
Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>
2024-01-18 13:57:22 +01:00
b1ackd0t fe97de024c NOISSUE - Add tests for pkg/clients (#258)
Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>
2024-01-16 13:25:52 +01:00
b1ackd0t 021f15ac77 NOISSUE - Add group API tests (#243)
Signed-off-by: rodneyosodo <blackd0t@protonmail.com>
2024-01-12 17:41:09 +01:00
Ian Ngethe Muchiri 9f573850fc NOISSUE - Add pagemetadata to ReadMessage function in sdk (#2055)
Signed-off-by: ianmuchyri <ianmuchiri8@gmail.com>
2024-01-10 18:11:57 +01:00
b1ackd0t e8bf29d3fe NOISSUE - Add group service tests (#241)
Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>
2024-01-10 11:48:41 +01:00
b1ackd0t f7037397e5 NOISSUE - Add tests for auth config package (#251)
Improve authentication functionality, error handling, setup functions, add client and handler, new test file and test cases

Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>
2024-01-08 14:19:55 +01:00
b1ackd0t 22ecbc24ee NOISSUE - Refactor error handling and SDK error testing (#263)
Improve error handling and SDK error testing. The code now includes signal handling, error wrapping, checking for contained errors, and testing HTTP error responses. Additionally, assertions have been added to ensure the expected behavior is met.

Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>
2024-01-08 11:33:16 +01:00
Ian Ngethe Muchiri b13357666a NOISSUE - Update Magistrala's mProxy and SenML dependencies (#250)
* update senml from mainflux to absmach repo

Signed-off-by: ianmuchyri <ianmuchiri8@gmail.com>

* update api documentation for websocket and mqtt

Signed-off-by: ianmuchyri <ianmuchiri8@gmail.com>

---------

Signed-off-by: ianmuchyri <ianmuchiri8@gmail.com>
2024-01-03 12:12:44 +01:00
b1ackd0t e01a82e84b NOISSUE - Expand filters to check for test changes (#213)
* Expand filters to check for test changes

This is because sometimes SDK tests failed to pass on push to main
because for PR we were only testing directory changes.

Signed-off-by: rodneyosodo <blackd0t@protonmail.com>

* Fix failing SDK tests by adding authz

Signed-off-by: rodneyosodo <blackd0t@protonmail.com>

* Rename pipeline to workflow

Signed-off-by: rodneyosodo <blackd0t@protonmail.com>

* Rename push branch to main

Signed-off-by: rodneyosodo <blackd0t@protonmail.com>

---------

Signed-off-by: rodneyosodo <blackd0t@protonmail.com>
2023-12-27 12:58:28 +01:00
b1ackd0t 160b70e9dc NOISSUE - Add config tests (#190)
Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>
2023-12-26 16:12:23 +01:00
b1ackd0t 2944e8881e NOISSUE - Generate event sourcing mocks (#186)
Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>
2023-12-22 11:32:49 +01:00
Arvindh 1fe2e74a74 NOISSUE - Implement Thing Delete (#179)
* add: delete function in things interface

Signed-off-by: Arvindh <arvindh91@gmail.com>

* add: remove things

Signed-off-by: Arvindh <arvindh91@gmail.com>

* fix: things event streams

Signed-off-by: Arvindh <arvindh91@gmail.com>

* add: things delete test

Signed-off-by: Arvindh <arvindh91@gmail.com>

* add: delete thing http transport

Signed-off-by: Arvindh <arvindh91@gmail.com>

* add: delete thing sdk, sdk_test, cli

Signed-off-by: Arvindh <arvindh91@gmail.com>

* gofumpt -ed

Signed-off-by: Arvindh <arvindh91@gmail.com>

* add: openapi

Signed-off-by: Arvindh <arvindh91@gmail.com>

* fix: things change status response

Signed-off-by: Arvindh <arvindh91@gmail.com>

* add: openapi

Signed-off-by: Arvindh <arvindh91@gmail.com>

* rename events: from thing delete to thing remove

Signed-off-by: Arvindh <arvindh91@gmail.com>

* fix wordings

Signed-off-by: Arvindh <arvindh91@gmail.com>

* fix wordings in openapi

Signed-off-by: Arvindh <arvindh91@gmail.com>

* add: type check

Signed-off-by: Arvindh <arvindh91@gmail.com>

* update open api yaml

Signed-off-by: Arvindh <arvindh91@gmail.com>

* fix things mocks

Signed-off-by: Arvindh <arvindh91@gmail.com>

---------

Signed-off-by: Arvindh <arvindh91@gmail.com>
2023-12-20 19:55:38 +01:00
b1ackd0t c3c910d9e3 NOISSUE - Generate Things repository mocks (#162)
* Generate things repository mocks

Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>

* Generate things cache mocks

Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>

* Change output dir for generated mocks

Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>

* rename factory methods

Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>

* Fix failing test

Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>

---------

Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>
2023-12-20 12:42:16 +01:00
Felix Gateru a6dd160091 MG-149 - Fix leaking database errors (#183)
* fix: handle database errors in svc

Signed-off-by: felix.gateru <felix.gateru@gmail.com>

* fix: add descriptive error to postgres errors

Signed-off-by: felix.gateru <felix.gateru@gmail.com>

---------

Signed-off-by: felix.gateru <felix.gateru@gmail.com>
2023-12-20 10:51:04 +01:00
Arvindh 648655036e NOISSUE - Implementation of Group removal (#161)
* add: group delete flow

Signed-off-by: Arvindh <arvindh91@gmail.com>

* sync with master

Signed-off-by: Arvindh <arvindh91@gmail.com>

* improved grpc error handling

Signed-off-by: Arvindh <arvindh91@gmail.com>

* gofumpt -ed

Signed-off-by: Arvindh <arvindh91@gmail.com>

* changed database unassign parent group id

Signed-off-by: Arvindh <arvindh91@gmail.com>

* seperate event for delete group

Signed-off-by: Arvindh <arvindh91@gmail.com>

* change group event name

Signed-off-by: Arvindh <arvindh91@gmail.com>

* update channel remove events

Signed-off-by: Arvindh <arvindh91@gmail.com>

* fix: channels event

Signed-off-by: Arvindh <arvindh91@gmail.com>

* add: sdk, sdk_tet, cli

Signed-off-by: Arvindh <arvindh91@gmail.com>

* fix: sdk mock

Signed-off-by: Arvindh <arvindh91@gmail.com>

* mockery

Signed-off-by: Arvindh <arvindh91@gmail.com>

* convert to inline case

Signed-off-by: Arvindh <arvindh91@gmail.com>

* change in group delete flow

Signed-off-by: Arvindh <arvindh91@gmail.com>

* change return error in delete

Signed-off-by: Arvindh <arvindh91@gmail.com>

* add: openapi

Signed-off-by: Arvindh <arvindh91@gmail.com>

* rename events: from channel delete to channel remove

Signed-off-by: Arvindh <arvindh91@gmail.com>

---------

Signed-off-by: Arvindh <arvindh91@gmail.com>
2023-12-19 13:01:24 +01:00
b1ackd0t 3112865810 NOISSUE - Generate PubSub mocks (#157)
* Refactor codegen to include pubsub

The commit includes changes to files related to messaging using the PubSub pattern.
It introduces a new step for checking PubSub updates and generating mocks.
Additionally, a new file for autogenerated mock code has been added.
Function and test case modifications have been made, including the use of mock implementations and checking for expected errors.
The commit also defines a mock implementation of a publisher-subscriber system using websockets.

Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>

* Add error check for authentication

modify error handling, and return 401 status code in updateClientSecret function

Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>

* Change output dir for generated mocks

Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>

---------

Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>
2023-12-15 14:56:28 +01:00
b1ackd0t da79c82208 NOISSUE - Generate Users repository mocks (#160)
* Generate users repository mocks

Add generation of users repository mocks for easier testing purposes
rather than writing the mocks

Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>

* Change output dir for generated mocks

Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>

---------

Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>
2023-12-15 14:32:16 +01:00
Arvindh 450a8f94a2 MG-50 - Auth: Improve gRPC response with error codes (#142)
* add: grpc error handling

Signed-off-by: Arvindh <arvindh91@gmail.com>

* fix: golangci errors & remove: switch case placeholders

Signed-off-by: Arvindh <arvindh91@gmail.com>

* Handle ok case error

* Handle ok case error

Signed-off-by: Arvindh <arvindh91@gmail.com>

---------

Signed-off-by: Arvindh <arvindh91@gmail.com>
2023-12-15 11:17:20 +01:00
b1ackd0t aaf0756707 NOISSUE - Generate SDK Mocks (#127)
* fix(errors): Fix nil pointer error in NewSDKError

In the NewSDKError function, a check is added to handle the case where the input error is nil. Previously, if the error was nil, the function would panic. This fix ensures that the function returns nil instead of panicking when the input error is nil.

Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>

* feat(sdk-mock): Add mock functions for SDK testing

This commit adds a set of mock functions for the software development kit (SDK) to facilitate testing. These functions simulate the behavior of the actual functions in the SDK and have defined input parameters and return values. The code also includes error handling logic and checks for different return types.

Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>

* test: use sdk mocked interface

* feat(workflow): check for generated files

The commit modifies the check-proto GitHub workflow to check-generated files. It checks for changes in specific paths and verifies the protobuf files and generated mocks. The code also includes checking if the SDK mock is up to date, installing a tool, generating mocks, and displaying an error message if the mocks are different. The tool we use is: https://github.com/vektra/mockery.

Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>

* feat(mocks): Add copyright notice to mocks.go

Added a copyright notice to the mocks.go file in the pkg/sdk/go directory for clarity and attribution.

Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>

* feat(build): Add target for generating mocks

Added a new target to the Makefile for generating mocks using the mockery tool. The target checks if the mockery tool is installed and then runs the "go generate" command to generate mocks for the codebase..

Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>

* Improve error messages in check-generated-files.yml

In this commit, I have made changes to the check-generated-files.yml file. Specifically, I have updated the error messages to provide more information about the issue. Instead of simply stating that the proto file and generated Go file are out of sync, the error message now includes a more detailed explanation and a suggestion for resolving the issue. Additionally, I have also added error messages for the generated mocks for the SDK. These error messages provide information about the sync issue and suggest running the necessary commands to resolve it. This commit aims to improve the clarity of error messages and help developers quickly identify and fix sync issues in the codebase.

Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>

---------

Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>
2023-12-15 09:25:05 +01:00
Felix Gateru 4d038c633a MG-31 - Fix pkg tests (#123)
* Fix pkg tests

Signed-off-by: felix.gateru <felix.gateru@gmail.com>

* fix errors

* refactor groups tests

Signed-off-by: felix.gateru <felix.gateru@gmail.com>

* Add opts to docker containers

Signed-off-by: felix.gateru <felix.gateru@gmail.com>

* Fix pkg tests

Signed-off-by: felix.gateru <felix.gateru@gmail.com>

* Remove unvailable publish test

Signed-off-by: felix.gateru <felix.gateru@gmail.com>

* Remove unvailable publish test

Signed-off-by: felix.gateru <felix.gateru@gmail.com>

* Cleaning up

Signed-off-by: felix.gateru <felix.gateru@gmail.com>

* Cleaning up

Signed-off-by: felix.gateru <felix.gateru@gmail.com>

---------

Signed-off-by: felix.gateru <felix.gateru@gmail.com>
2023-12-12 16:09:05 +01:00
b1ackd0t 5aaf1da35a NOISSUE - Add order & direction to list Users API (#88)
* feat: API layer for search

Implement the API layer for search. This includes the following:
- API endpoints for search
- Logging
- Metrics
- Tracing

* fix(api): fix default order in common.go

The default order in the common.go file was set to "updated_by" instead of "updated_at". This commit fixes the default order to "updated_at" to ensure accurate sorting.

Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>

* test: Add test function for search clients

The test function creates a new service with mock dependencies and tests various scenarios, including authorized and invalid tokens. It also checks the response and error values. The test function sets up mock calls and asserts expected values.

Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>

* refactor(users): remove search endpoint

Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>

---------

Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>
2023-12-12 11:04:24 +01:00
b1ackd0t a07aabe783 NOISSUE - Add Invitation service (#126)
* feat(service): Add new "invitations" service

This commit adds a new service called "invitations" to the existing file. The service includes the necessary imports and initializes components for its functionality. It also includes configuration settings and a Docker Compose file. Additionally, instructions for deploying and using the service are provided, along with a function to create an HTTP handler.

Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>

* docs(api): invitation api

The commit adds documentation for an API that allows users to manage invitations. It includes information about the endpoints, parameters, data types, and components used in the API. The documentation also outlines the properties and specifications of the Invitation object. This commit provides a comprehensive overview of the API's functionality and structure.

Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>

* fix: accept invitation to take in domain

Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>

* refactor(invitations): rename domain to domainID

Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>

* Authorize on id(domain+user) rather than user

Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>

---------

Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>
2023-12-11 18:24:37 +01:00
Arvindh a078bbe91d NOISSUE - Add view Domain permissions (#118)
* add: view domain permissions

Signed-off-by: Arvindh <arvindh91@gmail.com>

* "gofumpt" -ed

Signed-off-by: Arvindh <arvindh91@gmail.com>

* fix: retrieve group

Signed-off-by: Arvindh <arvindh91@gmail.com>

* change in approch for retrieve domain permissions

Signed-off-by: Arvindh <arvindh91@gmail.com>

* change to query fram approch

Signed-off-by: Arvindh <arvindh91@gmail.com>

* add: view domain permissions sdk

Signed-off-by: Arvindh <arvindh91@gmail.com>

* add: view domain permissions sdk

Signed-off-by: Arvindh <arvindh91@gmail.com>

* add: view domain permissions sdk

Signed-off-by: Arvindh <arvindh91@gmail.com>

* fix: golangci errors

Signed-off-by: Arvindh <arvindh91@gmail.com>

---------

Signed-off-by: Arvindh <arvindh91@gmail.com>
2023-12-11 09:41:31 +01:00
b1ackd0t 71e600798d MG-132 - Remove Identity From Basic Information (#94)
* refactor(clients): deprecate RetrieveNames

Remove RetrieveNames and modify RetrieveAllBasicInfo to replace it. Remove sensitive information when retrieving basic information

* change from if statement to switch

Co-authored-by: Dušan Borovčanin <borovcanindusan1@gmail.com>

---------

Co-authored-by: Dušan Borovčanin <borovcanindusan1@gmail.com>
2023-12-07 13:56:34 +01:00
Sammy Kerata Oina 6f0874c85a NOISSUE - Add Linters (#79)
* add linters

Signed-off-by: SammyOina <sammyoina@gmail.com>

* fix linting errors

Signed-off-by: sammy <sammyoina@gmail.com>

* fix linting

Signed-off-by: sammy <sammyoina@gmail.com>

* add callhome alias

Signed-off-by: sammy <sammyoina@gmail.com>

---------

Signed-off-by: SammyOina <sammyoina@gmail.com>
Signed-off-by: sammy <sammyoina@gmail.com>
2023-12-06 17:02:47 +01:00
Arvindh 3ef67f7ffd NOISSUE - Enable superadmin listing resources by domains (#105)
Signed-off-by: Arvindh <arvindh91@gmail.com>
2023-12-03 17:28:44 +01:00