-
-
Notifications
You must be signed in to change notification settings - Fork 1
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
Total refactor to add more type safety and testability #5
Draft
auspicacious
wants to merge
19
commits into
main
Choose a base branch
from
refactor
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from 13 commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
64d80a2
Checkpoint commit of work on creating an immutable state class.
auspicacious a3b13aa
Merge branch 'main' into refactor
auspicacious 6b69384
desc_metadata working
auspicacious 9acfcb9
desc_metadata now has JSON output
auspicacious 5fcc3ed
Intermediate commit, now checking to make sure environment health is …
auspicacious e4d9c4a
Preparation for unit-testing same_env command.
auspicacious 44caac6
First unit test for same_env.
auspicacious deebda4
Configurable delays to enable fast unit testing.
auspicacious 8934b08
new_env now passing basic unit tests
auspicacious cdbab7c
Intermediate commit while refactoring the CLI.
auspicacious 7410069
Refactored out JSON encoder extensions.
auspicacious 33399a8
Config saver now passes unit tests.
auspicacious 9e64fed
Config saver now passes unit tests.
auspicacious eef2e5c
Fixed a couple of references.
auspicacious e6c68c4
Added state unit test.
auspicacious e86ed18
Fix naming and indentation on git writer
matschaffer 857ab98
Merge pull request #6 from matschaffer/refactor
auspicacious 8bd000a
Fix field mismatch on EnvUpdateTimedOutException
matschaffer 3767ac9
Merge pull request #7 from matschaffer/refactor
auspicacious File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
argcomplete>=1.12.1,<2.0 | ||
boto3>=1.14.4,<2.0 | ||
dataclasses-json>=0.5.2,<2.0 | ||
GitPython>=3.1.3,<4.0 | ||
pycodestyle |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
from dataclasses import dataclass | ||
from dataclasses_json import dataclass_json | ||
from enum import Enum, unique | ||
|
||
|
||
@unique | ||
class EnvType(str, Enum): | ||
"""Encodes Safecast's understanding of environment types. | ||
""" | ||
DEV = 'dev' | ||
PROD = 'prd' | ||
|
||
def __repr__(self): | ||
return '<%s.%s>' % (self.__class__.__name__, self.name) | ||
|
||
|
||
@unique | ||
class AwsTierType(str, Enum): | ||
WEB = 'web' | ||
WORKER = 'wrk' | ||
|
||
def __repr__(self): | ||
return '<%s.%s>' % (self.__class__.__name__, self.name) | ||
|
||
|
||
@dataclass_json | ||
@dataclass(frozen=True) | ||
class ParsedVersion: | ||
app: str | ||
circleci_build_num: int | ||
clean_branch_name: str | ||
git_commit: str | ||
version_string: str | ||
|
||
|
||
@dataclass_json | ||
@dataclass(frozen=True) | ||
class AwsState: | ||
aws_app_name: str | ||
envs: dict # dictionary mapping EnvTypes to a nested dictionary of AwsTierTypes to AwsTier objects | ||
|
||
|
||
@dataclass_json | ||
@dataclass(frozen=True) | ||
class AwsTier: | ||
tier_type: AwsTierType | ||
platform_arn: str | ||
parsed_version: ParsedVersion | ||
name: str | ||
environment_id: str # Note this is calculated by AWS and will not be available prior to new environment creation | ||
num: int |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 got an error here trying to take it for a spin:
Maybe this should be like this?
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.
Though I tried that then got
So still need to dig more I guess.
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.
Sorry, not a lot of test coverage on that part of
state.py
. I've pushed a fix to that particular issue (neededself.
in front ofold_aws_state
) and I'm going to see if I can add a basic unit test of that code.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.
Getting this now
Plus it looks like you might be missing
import operator