-
Notifications
You must be signed in to change notification settings - Fork 99
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
Watt Time v3 Support #532
Watt Time v3 Support #532
Conversation
First draft of the ADR for watt time v3 changes. Looking at path mappings and parameters. Still plenty to work on.
Moved ADR to correct location
Signed-off-by: Vaughan Knight <[email protected]>
Signed-off-by: Vaughan Knight <[email protected]>
…e-Foundation/carbon-aware-sdk into wattime-v3-support
updated notes for BA Signed-off-by: Vaughan Knight <[email protected]>
First draft of the ADR for watt time v3 changes. Looking at path mappings and parameters. Still plenty to work on.
Moved ADR to correct location
Signed-off-by: Vaughan Knight <[email protected]>
updated notes for BA Signed-off-by: Vaughan Knight <[email protected]>
More updates.
Added AuthenticationBaseUrl to the configuration and updated Authentication to leverage the v3 authenication path - note the API is not updated and will require further updates.
Updated start and end configuration to new values
Balancing Authority Renamed to Region. Does not include updates to API, just the Query String parameter.
Updates for historical data API
Removed accidental file
Lots of test updates, need to do some fixes.
Historical forecasts updated
I, Vaughan Knight <[email protected]>, hereby add my Signed-off-by to this commit: b9490e4 I, Vaughan Knight <[email protected]>, hereby add my Signed-off-by to this commit: b991bac I, Vaughan Knight <[email protected]>, hereby add my Signed-off-by to this commit: e4f1494 I, Vaughan Knight <[email protected]>, hereby add my Signed-off-by to this commit: b443e9e I, Vaughan Knight <[email protected]>, hereby add my Signed-off-by to this commit: ab1205d I, Vaughan Knight <[email protected]>, hereby add my Signed-off-by to this commit: 7c115fa I, Vaughan Knight <[email protected]>, hereby add my Signed-off-by to this commit: e047c9a I, Vaughan Knight <[email protected]>, hereby add my Signed-off-by to this commit: aa81382 I, Vaughan Knight <[email protected]>, hereby add my Signed-off-by to this commit: 8640c8c I, Vaughan Knight <[email protected]>, hereby add my Signed-off-by to this commit: 880fcf7 Signed-off-by: Vaughan Knight <[email protected]>
Many tests reworked, a few to go. Consolidated a lot of the hand crafted json objects into objects that get serialized as the purist JsonObject format was prone to errors - in some cases tests were passing even with bad typing.
Further test updates
…e-Foundation/carbon-aware-sdk into wattime-v3-support
…e-Foundation/carbon-aware-sdk into wattime-v3-support
Further updates, just 1 test left to remediate
…ests Updated to add authentication client to the service builder for the tests. All tests now passing.
Renaming of Balancing Authority to Region through all code and comments. This will also need updating through documentation.
src/CarbonAware.DataSources/CarbonAware.DataSources.WattTime/src/Client/WattTimeClient.cs
Fixed
Show fixed
Hide fixed
src/CarbonAware.DataSources/CarbonAware.DataSources.WattTime/src/Client/WattTimeClient.cs
Fixed
Show fixed
Hide fixed
Fixed spelling error in latitude
src/CarbonAware.DataSources/CarbonAware.DataSources.WattTime/src/Client/WattTimeClient.cs
Dismissed
Show dismissed
Hide dismissed
src/CarbonAware.DataSources/CarbonAware.DataSources.WattTime/src/Client/WattTimeClient.cs
Dismissed
Show dismissed
Hide dismissed
src/CarbonAware.DataSources/CarbonAware.DataSources.WattTime/mock/WattTimeDataSourceMocker.cs
Outdated
Show resolved
Hide resolved
src/CarbonAware.DataSources/CarbonAware.DataSources.WattTime/mock/WattTimeDataSourceMocker.cs
Show resolved
Hide resolved
Updates based on code review for WattTime Tests. Mostly cleanup of constants which were removed elsewhere in tests.
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.
These updates will need propagating to the version upgrade documentation @danuw just tagging you so we don't forget. RegionCacheTTL replaces BalancingAuthorityCacheTTL.
src/CarbonAware.DataSources/CarbonAware.DataSources.WattTime/test/Client/WattTimeClientTests.cs
Outdated
Show resolved
Hide resolved
src/CarbonAware.DataSources/CarbonAware.DataSources.WattTime/test/Client/WattTimeClientTests.cs
Outdated
Show resolved
Hide resolved
src/CarbonAware.DataSources/CarbonAware.DataSources.WattTime/test/Client/WattTimeClientTests.cs
Outdated
Show resolved
Hide resolved
src/CarbonAware.DataSources/CarbonAware.DataSources.WattTime/test/Client/WattTimeClientTests.cs
Outdated
Show resolved
Hide resolved
src/CarbonAware.DataSources/CarbonAware.DataSources.WattTime/test/WattTimeDataSourceTests.cs
Show resolved
Hide resolved
Cleaned up a lot of the string literals. They were causing too much fragility in the code base, and made it complex when updating the WattTime API.
More cleanup of some of the strings. Creating consistency for using the test data on parameters and not just reponses also.
Updates to documentation and changelog
EDIT: False alarm, the below tests succeed on a fresh clone of the repo, the below stack trace I am leaving for openness’s sake, but it was due to a remnant
|
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, I left 3 comments for small changes, which would be nice to see but happy for it to get merged without them as well. Thanks for moving WattTime test magic numbers to a single file btw :)
@@ -238,7 +249,8 @@ private async Task UpdateAuthTokenAsync() | |||
private void SetBasicAuthenticationHeader() | |||
{ | |||
var authToken = Encoding.UTF8.GetBytes($"{this._configuration.Username}:{this._configuration.Password}"); | |||
this._client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue(AuthenticationHeaderTypes.Basic, Convert.ToBase64String(authToken)); | |||
//this._client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue(AuthenticationHeaderTypes.Basic, Convert.ToBase64String(authToken)); |
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.
We can drop the comment? (this._client
will not exist after the PR comes through in this context)
|
||
|
||
[JsonPropertyName("meta")] | ||
public GridEmissionsMetaData Meta { get; set; } |
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.
nit: constructor will leave null value if called without params, maybe make nullable (add ?
) or return empty.
|
||
|
||
[JsonPropertyName("meta")] | ||
public GridEmissionsMetaData Meta { get; set; } |
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.
NIT: same as before, can make nullable or by default initialise an empty GridEmissionsMetaData object
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.
Both ElectricityMaps and ElectricityMapsFree datasources works fine on my machine, and also all tests has passed on Visual Studio 2022 Community.
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
Pull Request
Issue Number: #510
Summary
PR for all WattTime v3 updates
Changes
Checklist
Are there API Changes?
If yes, what are the expected API Changes? Please link to an API-Comparison
workflow with the API Diff.
Is this a breaking change?
If yes, what workflow does this break?
Anything else?
Other comments, collaborators, etc.
This PR Closes #<issue_number>