-
Notifications
You must be signed in to change notification settings - Fork 2
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
refactor: adjust configuration management and smoke test setup to support production config by default #232
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know it's still on draft, but so far it looks good and I don't have any questions or nits 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added a few comments
server/src/main/java/com/hedera/block/server/config/ServerMappedConfigSourceInitializer.java
Show resolved
Hide resolved
server/src/main/java/com/hedera/block/server/config/ServerMappedConfigSourceInitializer.java
Outdated
Show resolved
Hide resolved
...er/src/test/java/com/hedera/block/server/config/ServerMappedConfigSourceInitializerTest.java
Show resolved
Hide resolved
...er/src/test/java/com/hedera/block/server/config/ServerMappedConfigSourceInitializerTest.java
Outdated
Show resolved
Hide resolved
server/src/main/java/com/hedera/block/server/config/ServerMappedConfigSourceInitializer.java
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, just one nitpick (which can be addressed later), and one block of text that should be a github discussion rather than a comment in code.
...er/src/test/java/com/hedera/block/server/config/ServerMappedConfigSourceInitializerTest.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. Since you changed something in .github/workflows
you might need approval from someone in RE or DevOps.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review applies to
.github/workflows/smoke-test.yaml
README.md
LGTM
@ata-nas, it appears that most of your commits on this PR are unsigned. git rebase --gpg-sign -f HEAD~20
git push --force |
Signed-off-by: Atanas Atanasov <[email protected]>
6dd22fe
to
4f39560
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #232 +/- ##
=======================================
Coverage ? 99.78%
Complexity ? 259
=======================================
Files ? 52
Lines ? 938
Branches ? 64
=======================================
Hits ? 936
Misses ? 2
Partials ? 0
|
Description:
System.getenv()
and it only shows case-sensitive keys, so adding a value likemediator.ringBufferSize=1024
will result into not being visible in runtime, it seems to me to be inconsistent. (2) build the jar for the smoke tests with theapp.properties
fromsrc/test/resources
- this works, the file gets packaged into the jar, only hurdle currently is to find a good and reliable way to do it with agradle
task.gradle
task execution should be sufficient to build and run the needed environment for the test to passUPDATE:
after some discussions with @mattp-swirldslabs & @AlfredoG87, we have discussed some issues that we have discovered:
_
.;gradle
task (see some previous commits in this PR) that will build the project with correct test props, create the docker image and run it (so we can have an easy single entry point) did not seem to work when I tried it, since when ingh actions
I execute either a shell script or thegradle
task that contains a shell invocation of thedocker
executable,gh actions
failed with exit code 14 (insufficient privileges). After some research, I see that I probably need to use thedocker
executable directly in therun
part of the step. That worked and the test passed after commiting. So this part is still debatable, can I or can I not use thedocker
executable from a shell script.;since this discussions, there are several discoveries:
IntelliJ
IDE, if we modify the run config to include an environment variable with lowercase and.
separator, it gets discovered. I am still to understand how that works and why, it does not seem to get passed as an CLI arg when starting the jar, so the IDE is doing something else. But that only means that it is indeed possible to discover non-conventional keys for environment variables.;PropertyFileConfigSource.class
and read vars directly from a file (this is different fromClasspathFileConfigSource.java
where we technically still load a fileapp.properties
but this is packaged into the jar, here we are talking about an arbitrary file outside theclasspath
), this worked and is a potential approach. However, it has the lowest precedence, so if the same key comes from basically any other source, this will get overridden, we need to keep that in mind. Ordinals could be set in the constructor, so we can decide precedence. (seeConfigSourceOrdinalConstants.java
);final approach (or the usage of multiple approaches so more could be tested if decided so) is still under debate;
UPDATE:
mediator.ringBufferSize=1024
will be picked up without having to do anything special). Until then, we can use theMappedConfigSource
in order to support the mapping between uppercase variables and the formate we need them (for example the env variableMEDIATOR_RING_BUFFER_SIZE=1024
will be available with that key as well as with this onemediator.ringBufferSize=1024
). For now, we can only pick up uppercase variables with an_
separator, but with the mapping, we will be able to read the values with the mapped key.Related issue(s):
Fixes #185
Notes for reviewer:
Tested locally:
jar
directly and useapp.properties
jar
directly and useenv
varsdocker
container and useapp.properties
docker
container and useenv
varssmoke-test
action locally and useapp.properties
smoke-test
action locally and useenv
varsk8s
cluster with the container and useapp.properties
k8s
cluster with the container and useenv
varsapp.properties
andenv
vars, expected that theenv
vars take precedence (as is by default and we have not changed the default precedence)Checklist