Add patch config endpoint #4
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "add-update-config-endpoint"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Motivation
We need our first use case where a property on the server is configured by a HTTP request to the ktc-manager. A relatively easy scenario is updating the hostname of the server. We'll start with a patch config endpoint where the request specifies only the properties that are expected to change. It's important to get a fairly decent software architecture for this part. We don't have any experience building this program yet, so we don't want to overengineer it, but we can make some educated guesses that a good architecture should:
Solution
Started by refactoring the test code. It was very verbose, and it's a good opportunity to clean it up before we start writing a lot more tests. It could still go a little bit further, but it's ok for now since I don't know how often we're going to have separate test cases vs a single large test case with many steps.
Since it takes a long time to star up the VM, I figured we want to make each test case actually a separate step rather than a completely separate test with a fresh VM instance each time. Otherwise, every single test case would take ~1 minute, rather than less than 1 second. It's a fair tradeoff for a few orders of magnitude reduction in test time.
Added logging middleware to Hono — it was the first thing I noticed when running the new test case.
I started following my Functional Domain Driven Design patterns, but I'm not sure how relevant they're going to be in this code base. In this example there wasn't any business logic — we take a value, we try to set it, that succeeds or fails.
The core of this solution is
makeStateProperty— it encapsulates all of the common logic when getting, setting, and refreshing properties. We will use this function for every property of the server that's managed by ktc. The code list file could be broken up and reflect it a little, but it would be good to use it more first.