コード例 #1
0
def test_annotations_store_deprecates_name():
    with pytest.deprecated_call(match=r'name= is deprecated'):
        storage = AnnotationsDiffBaseStorage(
            name='my-operator.my-company.com/diff-base')
    assert storage.prefix == 'my-operator.my-company.com'
    assert storage.key == 'diff-base'
    assert storage.name == 'my-operator.my-company.com/diff-base'
コード例 #2
0
 def __init__(
     self,
     name: str = 'kopf.zalando.org/last-handled-configuration',
     field: FieldSpec = 'status.kopf.last-handled-configuration',
 ):
     super().__init__([
         AnnotationsDiffBaseStorage(name=name),
         StatusDiffBaseStorage(field=field),
     ])
コード例 #3
0
 def __init__(
     self,
     prefix: str = 'kopf.zalando.org',
     key: str = 'last-handled-configuration',
     field: FieldSpec = 'status.kopf.last-handled-configuration',
 ):
     super().__init__([
         AnnotationsDiffBaseStorage(prefix=prefix, key=key),
         StatusDiffBaseStorage(field=field),
     ])
コード例 #4
0
def test_annotations_storage_with_prefix_and_key():
    storage = AnnotationsDiffBaseStorage(prefix='my-operator.my-company.com',
                                         key='diff-base')
    assert storage.prefix == 'my-operator.my-company.com'
    assert storage.key == 'diff-base'
    assert storage.name == 'my-operator.my-company.com/diff-base'
コード例 #5
0
def test_annotations_store_with_defaults():
    storage = AnnotationsDiffBaseStorage()
    assert storage.prefix == 'kopf.zalando.org'
    assert storage.key == 'last-handled-configuration'
    assert storage.name == 'kopf.zalando.org/last-handled-configuration'
コード例 #6
0
def test_annotations_store_deprecates_nonprefixed():
    with pytest.deprecated_call(match=r'Non-prefixed storages are deprecated'):
        storage = AnnotationsDiffBaseStorage(prefix=None, key='diff-base')
    assert storage.prefix is None
    assert storage.key == 'diff-base'
    assert storage.name == 'diff-base'
コード例 #7
0
def test_annotations_storage_with_name():
    storage = AnnotationsDiffBaseStorage(
        name='my-operator.my-company.com/diff-base')
    assert storage.name == 'my-operator.my-company.com/diff-base'