Skip to content

Commit

Permalink
Update to Aerie 3.x
Browse files Browse the repository at this point in the history
Updates to Aerie 3.x. This breaks compatibility with Aerie 2.x only for the uploadDictionary capability.
  • Loading branch information
David Legg committed Dec 17, 2024
1 parent 1f81170 commit 14511e9
Show file tree
Hide file tree
Showing 12 changed files with 28 additions and 30 deletions.
2 changes: 1 addition & 1 deletion .env
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
DOCKER_TAG=v2.18.0
DOCKER_TAG=v3.2.0
REPOSITORY_DOCKER_URL=ghcr.io/nasa-ammos

AERIE_USERNAME=aerie
Expand Down
18 changes: 8 additions & 10 deletions src/aerie_cli/aerie_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -1452,7 +1452,7 @@ def get_scheduling_goals_by_specification(self, spec_id):

return resp

def create_dictionary(self, dictionary: str, dictionary_type: Union[str, DictionaryType]) -> int:
def create_dictionary(self, dictionary: str) -> int:
"""Upload an AMPCS command, channel, or parameter dictionary to an Aerie instance
Args:
Expand All @@ -1463,23 +1463,21 @@ def create_dictionary(self, dictionary: str, dictionary_type: Union[str, Diction
int: Dictionary ID
"""

if not isinstance(dictionary_type, DictionaryType):
dictionary_type = DictionaryType(dictionary_type)

query = """
mutation CreateDictionary($dictionary: String!, $type: String!) {
createDictionary: uploadDictionary(dictionary: $dictionary, type: $type) {
id
mutation CreateDictionary($dictionary: String!) {
createDictionary: uploadDictionary(dictionary: $dictionary) {
command
channel
parameter
}
}
"""
resp = self.aerie_host.post_to_graphql(
query,
dictionary=dictionary,
type=dictionary_type.value
dictionary=dictionary
)
return next(iter(resp.values()))["id"]

return resp["id"]

def list_dictionaries(self) -> Dict[DictionaryType, List[DictionaryMetadata]]:
"""List all command, parameter, and channel dictionaries
Expand Down
6 changes: 5 additions & 1 deletion src/aerie_cli/aerie_host.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,11 @@
from attrs import define, field

COMPATIBLE_AERIE_VERSIONS = [
"2.18.0"
"3.0.0",
"3.0.1",
"3.1.0",
"3.1.1",
"3.2.0",
]

class AerieHostVersionError(RuntimeError):
Expand Down
2 changes: 1 addition & 1 deletion tests/integration_tests/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ python3 -m pytest .

Integration tests are automatically run by CI against all supported Aerie versions. To add and test support for a new Aerie version:

1. Download the appropriate version release JAR for the [Banananation model](https://github.com/NASA-AMMOS/aerie/packages/1171106/versions) and add it to `tests/integration_tests/models`, named as `banananation-X.X.X.jar` (substituting the correct version number).
1. Download the appropriate version release JAR for the [Banananation model](https://github.com/NASA-AMMOS/aerie/packages/1171106/versions) and add it to `tests/integration_tests/files/models`, named as `banananation-X.X.X.jar` (substituting the correct version number).
2. Update the [`.env`](../../.env) file `DOCKER_TAG` value to the new version string. This defaults the local deployment to the latest Aerie version.
3. Update [`docker-compose-test.yml`](../../docker-compose-test.yml) as necessary to match the new Aerie version. The [aerie-ui compose file](https://github.com/NASA-AMMOS/aerie-ui/blob/develop/docker-compose-test.yml) can be a helpful reference to identify changes.
4. Manually run the integration tests and update the code and tests as necessary for any Aerie changes.
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
2 changes: 1 addition & 1 deletion tests/integration_tests/test_expansion.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def set_up_environment(request):

global command_dictionary_id
with open(COMMAND_DICTIONARY_PATH, 'r') as fid:
command_dictionary_id = client.create_dictionary(fid.read(), "COMMAND")
command_dictionary_id = client.create_dictionary(fid.read())

global parcel_id
parcel_id = client.create_parcel(Parcel("Integration Test", command_dictionary_id, None, None, []))
Expand Down
10 changes: 5 additions & 5 deletions tests/integration_tests/test_goals.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,15 +68,15 @@ def set_up_environment(request):
def cli_goal_upload_ts():
result = runner.invoke(
app,
["goals", "new", GOAL_PATH_1, "-p", plan_id],
["scheduling", "new", GOAL_PATH_1, "-p", plan_id],
catch_exceptions=False,
)
return result

def cli_goal_upload_jar():
result = runner.invoke(
app,
["goals", "new", GOAL_PATH_2, "-p", plan_id],
["scheduling", "new", GOAL_PATH_2, "-p", plan_id],
catch_exceptions=False
)
return result
Expand Down Expand Up @@ -108,7 +108,7 @@ def test_schedule_upload():
def test_goal_update():
result = runner.invoke(
app,
["goals", "update", GOAL_PATH_2],
["scheduling", "update", GOAL_PATH_2],
catch_exceptions=False
)
assert result.exit_code == 0, \
Expand All @@ -121,7 +121,7 @@ def test_goal_delete():

result = runner.invoke(
app,
["goals", "delete"],
["scheduling", "delete"],
input=str(goal_id) + "\n",
catch_exceptions=False,
)
Expand All @@ -137,7 +137,7 @@ def test_schedule_delete_all():
# Delete all goals
result = runner.invoke(
app,
["goals", "delete-all-goals-for-plan"],
["scheduling", "delete-all-goals-for-plan"],
input=str(plan_id) + "\n",
catch_exceptions=False,
)
Expand Down
18 changes: 7 additions & 11 deletions tests/integration_tests/test_parcels.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def assert_deleted(dictionaries: List[DictionaryMetadata], id: int) -> bool:

def test_command_dictionary():
with open(COMMAND_XML_PATH, "r") as fid:
id = client.create_dictionary(fid.read(), DictionaryType.COMMAND)
id = client.create_dictionary(fid.read())

assert_mission_version(
client.list_dictionaries()[DictionaryType.COMMAND], id, "Banana Nation", "1.0.0.0")
Expand All @@ -48,7 +48,7 @@ def test_command_dictionary():

def test_channel_dictionary():
with open(CHANNEL_XML_PATH, "r") as fid:
id = client.create_dictionary(fid.read(), DictionaryType.CHANNEL)
id = client.create_dictionary(fid.read())

assert_mission_version(
client.list_dictionaries()[DictionaryType.CHANNEL], id, "Banana Nation", "1.0.0.0")
Expand All @@ -61,7 +61,7 @@ def test_channel_dictionary():

def test_parameter_dictionary():
with open(PARAMETER_XML_1_PATH, "r") as fid:
id = client.create_dictionary(fid.read(), DictionaryType.PARAMETER)
id = client.create_dictionary(fid.read())

assert_mission_version(
client.list_dictionaries()[DictionaryType.PARAMETER], id, "Banana Nation", "1.0.0.1")
Expand Down Expand Up @@ -91,17 +91,13 @@ def test_adaptation():
def test_parcels():
# Set up
with open(COMMAND_XML_PATH, "r") as fid:
command_dictionary_id = client.create_dictionary(
fid.read(), DictionaryType.COMMAND)
command_dictionary_id = client.create_dictionary(fid.read())
with open(CHANNEL_XML_PATH, "r") as fid:
channel_dictionary_id = client.create_dictionary(
fid.read(), DictionaryType.CHANNEL)
channel_dictionary_id = client.create_dictionary(fid.read())
with open(PARAMETER_XML_1_PATH, "r") as fid:
parameter_dictionary_1_id = client.create_dictionary(
fid.read(), DictionaryType.PARAMETER)
parameter_dictionary_1_id = client.create_dictionary(fid.read())
with open(PARAMETER_XML_2_PATH, "r") as fid:
parameter_dictionary_2_id = client.create_dictionary(
fid.read(), DictionaryType.PARAMETER)
parameter_dictionary_2_id = client.create_dictionary(fid.read())
with open(ADAPTATION_JS_PATH, "r") as fid:
adaptation_id = client.create_sequence_adaptation(fid.read())

Expand Down

0 comments on commit 14511e9

Please sign in to comment.