ashb opened a new pull request #11694:
URL: https://github.com/apache/airflow/pull/11694


   <!--
   Thank you for contributing! Please make sure that your code changes
   are covered with tests. And in case of new features or big changes
   remember to adjust the documentation.
   
   Feel free to ping committers for the review!
   
   In case of existing issue, reference it using one of the following:
   
   closes: #ISSUE
   related: #ISSUE
   
   How to write a good git commit message:
   http://chris.beams.io/posts/git-commit/
   -->
   Example test case:
   
   Compare: 
https://github.com/apache/airflow/blob/782b8b374f191b13fa971db6bae501661139ed10/chart/tests/git-sync-scheduler_test.yaml#L30-L51
   
   ```yaml
       set:
         dags:
           gitSync:
             enabled: true
             containerName: git-sync-test
             containerTag: test-tag
             containerRepository: test-registry/test-repo
             wait: 66
             maxFailures: 70
             subPath: "path1/path2"
             dest: "test-dest"
             root: "/git-root"
             rev: HEAD
             depth: 1
             repo: https://github.com/apache/airflow.git
             branch: test-branch
             sshKeySecret: ~
             credentialsSecret: ~
             knownHosts: ~
           persistence:
             enabled: true
       asserts:
         - equal:
             path: spec.template.spec.containers[1]
             value:
               name: git-sync-test
               securityContext:
                 runAsUser: 65533
               image: test-registry/test-repo:test-tag
               env:
                 - name: GIT_SYNC_REV
                   value: HEAD
                 - name: GIT_SYNC_BRANCH
                   value: test-branch
                 - name: GIT_SYNC_REPO
                   value: https://github.com/apache/airflow.git
                 - name: GIT_SYNC_DEPTH
                   value: "1"
                 - name: GIT_SYNC_ROOT
                   value: /git-root
                 - name: GIT_SYNC_DEST
                   value: test-dest
                 - name: GIT_SYNC_ADD_USER
                   value: "true"
                 - name: GIT_SYNC_WAIT
                   value: "66"
                 - name: GIT_SYNC_MAX_SYNC_FAILURES
                   value: "70"
               volumeMounts:
                 - mountPath: /git-root
                   name: dags
   ``` 
   
   vs
   
   ```python
   class TestGitSyncSchedulerDeployment:
       """
       Basic tests of chart functionality
       """
   
       DEFAULT_TEMPLATES = ['scheduler/scheduler-deployment.yaml']
   
       def test_validate_git_sync_container_spec(self, render_chart):
           resources = render_chart(values={
               'dags': {
                   'gitSync': {
                       'enabled': True,
                       'containerName': 'git-sync-test',
                       'containerTag': 'test-tag',
                       'containerRepository': 'test-registry/test-repo',
                       'wait': 66,
                       'maxFailures': 70,
                       'subPath': 'path1/path2',
                       'dest': 'test-dest',
                       'root': '/git-root',
                       'rev': 'HEAD',
                       'depth': 1,
                       'repo': 'https://github.com/apache/airflow.git',
                       'branch': 'test-branch',
                       'sshKeySecret': None,
                       'credentialsSecret': None,
                       'knownHosts': None,
                   },
                   'persistence': {'enabled': True},
               },
           })
   
           assert len(resources) == 1
           resource = resources[0]
   
           assert resource['spec']['template']['spec']['containers'][1] == {
               'env': [
                   {'name': 'GIT_SYNC_REV', 'value': 'HEAD'},
                   {'name': 'GIT_SYNC_BRANCH', 'value': 'test-branch'},
                   {'name': 'GIT_SYNC_REPO', 'value': 
'https://github.com/apache/airflow.git'},
                   {'name': 'GIT_SYNC_DEPTH', 'value': '1'},
                   {'name': 'GIT_SYNC_ROOT', 'value': '/git-root'},
                   {'name': 'GIT_SYNC_DEST', 'value': 'test-dest'},
                   {'name': 'GIT_SYNC_ADD_USER', 'value': 'true'},
                   {'name': 'GIT_SYNC_WAIT', 'value': '66'},
                   {'name': 'GIT_SYNC_MAX_SYNC_FAILURES', 'value': '70'},
               ],
               'image': 'test-registry/test-repo:test-tag',
               'name': 'git-sync-test',
               'securityContext': {'runAsUser': 65533},
               'volumeMounts': [{'mountPath': '/git-root', 'name': 'dags'}],
           }
   ```


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to