Skip to content

Conversation

@jonavellecuerdo
Copy link
Contributor

@jonavellecuerdo jonavellecuerdo commented Aug 25, 2023

What does this PR do?

Refactor Carbon app to use new Symplectic FTP SSM parameters

Helpful background context

Prior to these updates, the Carbon app relied on three (3) separate SSM parameters
related to Symplectic Elements FTP credentials:

  • /tfvars/apps-vars/carbon/ftp-host;
  • /tfvars/apps-vars/carbon/ftp-pass; and
  • /tfvars/apps-vars/carbon/ftp-user

To simplify management of FTP credentials, FTP credentials are now stored
in a one (1) SSM parameter that consists of a single JSON formatted string.

Eventually, the deprecated SSM parameters should be removed to avoid confusion.

Also, @ehanson8 , I added a note about the minor issue related to the CLI test test_cli_connection_tests_fail in the README; figured it'd be easier to keep track off than the commit!

How can a reviewer manually see the effects of these changes?

  1. Review Cloudwatch log for successful connection tests with the Data Warehouse and Symplectic Elements FTP server.
  2. Review Cloudwatch log for a failed connection test with the Data Warehouse.
  3. Review Cloudwatch log for a failed connection test with the Symplectic Elements FTP server.

If you would like to run it yourself:

  1. Clone the repo.
  2. Check into this branch IN-887-use-new-symplectic-ftp-params.
  3. Create a new virtual environment.
  4. Install dependencies: make install.
  5. Run linters: make lint.
  6. Run test: make run-connection-tests-stage.

Includes new or updated dependencies?

NO

Developer

  • README is updated to reflect all changes as needed
  • All related Jira tickets are linked in commit message(s)

Code Reviewer

  • The commit message is clear and follows our guidelines
    (not just this pull request message)
  • There are appropriate tests covering any new functionality
  • The documentation has been updated to reflect all changes or is not needed
  • The changes have been verified
  • New dependencies are appropriate or there were no changes

@jonavellecuerdo jonavellecuerdo self-assigned this Aug 25, 2023
Why these changes are being introduced:
* Simplify management of FTP credentials by storing
components in a JSON formatted string

How this addresses that need:
* Expand connection tests for Data Warehouse and Symplectic Elements FTP server
* Update CLI tests
* Update README

Side effects of this change:
* None

Relevant ticket(s):
* https://mitlibraries.atlassian.net/browse/IN-887
@jonavellecuerdo jonavellecuerdo force-pushed the IN-887-use-new-symplectic-ftp-params branch from e32f063 to 0f2b4ed Compare August 25, 2023 15:54
@jonavellecuerdo jonavellecuerdo marked this pull request as ready for review August 25, 2023 15:54
Copy link
Contributor

@ehanson8 ehanson8 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This look great, smart to link the 2 connection tests together! Just a few suggestions

```bash
carbon --help
```
The Carbon application retrieves 'people' records from the Data Warehouse and generates an XML file that is uploaded to the Symplectic Elements FTP server. On Symplectic Elements, a job is scheduled to ingest the data from the XML file to create user accounts.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great context

Comment on lines 136 to 144
monkeypatch.setenv(
"SYMPLECTIC_FTP_JSON",
(
'{"SYMPLECTIC_FTP_HOST": "localhost", '
f'"SYMPLECTIC_FTP_PORT": "{ftp_socket[1]}",'
'"SYMPLECTIC_FTP_USER": "user", '
'"SYMPLECTIC_FTP_PASS": "pass"}'
),
)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is repeated several times in test_cli, can we make it a fixture? You can leave the block in test_cli_connection_tests_fail since you have to foul up the password

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please see the latest commit. I used the FTP server fixture when setting up the test environment (i.e.m=, _test_env fixture).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ftp_socket, ftp_directory = ftp_server
    os.environ["FEED_TYPE"] = feed_type
    os.environ["SYMPLECTIC_FTP_PATH"] = symplectic_ftp_path

Is there a way to reduce the repetition of this as well?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for noting this! I removed these lines of code from the tests so that it could properly use the feed_type and symplectic_ftp_path fixtures.

* Update '_test_env' to use FTP server fixture
* Simplify test_load_config_values_success
* Fix use of 'feed_type' and 'symplectic_ftp_path' fixtures
@jonavellecuerdo jonavellecuerdo force-pushed the IN-887-use-new-symplectic-ftp-params branch from 3769d2c to 3377425 Compare August 25, 2023 20:03
Copy link
Contributor

@ehanson8 ehanson8 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work!

@jonavellecuerdo jonavellecuerdo merged commit e6f079f into main Aug 25, 2023
@jonavellecuerdo jonavellecuerdo deleted the IN-887-use-new-symplectic-ftp-params branch August 25, 2023 20:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants