Skip to content
This repository has been archived by the owner on Apr 12, 2023. It is now read-only.

Add controller interface for directories #17

Merged
merged 7 commits into from
Dec 22, 2022

Conversation

JAORMX
Copy link
Contributor

@JAORMX JAORMX commented Dec 20, 2022

This creates constructs for applications to simply instantiate a
controller which will ensure that directories are up-to-date and
persistent in a local database. It also listens for events from an
event-queue and calls the reconcile function respectively.

The reconcile function is left as an interface, as reconciliation is
application specific. e.g. we don't know what users will do with a
directory change, but we want to make sure they know what to do.

Remaining

  • Only reconcile on events of directories we care for. e.g. children of the base directory.
  • Add tests

Signed-off-by: Juan Antonio Osorio juan.osoriorobles@eu.equinix.com

@JAORMX JAORMX changed the title Add controller interface for directories WIP: Add controller interface for directories Dec 20, 2022
@codecov
Copy link

codecov bot commented Dec 20, 2022

Codecov Report

Merging #17 (77ff4f2) into main (249efd7) will increase coverage by 5.35%.
The diff coverage is n/a.

@@            Coverage Diff             @@
##             main      #17      +/-   ##
==========================================
+ Coverage   87.98%   93.33%   +5.35%     
==========================================
  Files           4        3       -1     
  Lines         466      225     -241     
==========================================
- Hits          410      210     -200     
+ Misses         47       11      -36     
+ Partials        9        4       -5     
Flag Coverage Δ
unittests 93.33% <ø> (+5.35%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
internal/httpsrv/treemanager/treemanager.go

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@JAORMX JAORMX force-pushed the reconciler branch 2 times, most recently from efedb7a to 6e0a2f6 Compare December 21, 2022 15:43
This creates constructs for applications to simply instantiate a
controller which will ensure that directories are up-to-date and
persistent in a local database. It also listens for events from an
event-queue and calls the reconcile function respectively.

The reconcile function is left as an interface, as reconciliation is
application specific. e.g. we don't know what users will do with a
directory change, but we want to make sure they know what to do.

Signed-off-by: Juan Antonio Osorio <juan.osoriorobles@eu.equinix.com>
They're really integration tests and we should do more minimal unit
testing for the tree manager instead.

Signed-off-by: Juan Antonio Osorio <juan.osoriorobles@eu.equinix.com>
This is a simple test that merely verifies that the reconcile loop ran
on initialization. Based on this test, this commit also fixes all issues
found from testing.

Signed-off-by: Juan Antonio Osorio <juan.osoriorobles@eu.equinix.com>
Signed-off-by: Juan Antonio Osorio <juan.osoriorobles@eu.equinix.com>
We had a double-reconcile issue when notifications happened. Normally,
double reconciles are not a problem, but we do have a stateful
application since we rely on event tracking for testing.

This test now covers most of the functionality for the application

Signed-off-by: Juan Antonio Osorio <juan.osoriorobles@eu.equinix.com>
Signed-off-by: Juan Antonio Osorio <juan.osoriorobles@eu.equinix.com>
Goose is not thread safe... so, to deal with this, we globally lock the
goose migration code for the test utils.

Also, we do locking for the integration tests since those tests actually
use two schemas.

This only affects testing code.

Signed-off-by: Juan Antonio Osorio <juan.osoriorobles@eu.equinix.com>
@JAORMX JAORMX changed the title WIP: Add controller interface for directories Add controller interface for directories Dec 22, 2022
@JAORMX JAORMX merged commit 22a6823 into infratographer:main Dec 22, 2022
@JAORMX JAORMX deleted the reconciler branch December 22, 2022 12:35
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant