def test_copy():
        original = ScyllaYaml(
            redis_keyspace_replication_strategy='SimpleStrategy',
            client_encryption_options=ClientEncryptionOptions(
                enabled=True,
                certificate='/tmp/123.crt',
                keyfile='/tmp/123.key',
                truststore='/tmp/trust.pem',
            ),
            server_encryption_options=ServerEncryptionOptions(
                internode_encryption='all',
                certificate='/tmp/123.crt',
                keyfile='/tmp/123.key',
                truststore='/tmp/trust.pem',
            ))
        copy_instance = original.copy()
        assert copy_instance == original
        assert copy_instance.dict(exclude_unset=True,
                                  exclude_defaults=True) == original.dict(
                                      exclude_unset=True,
                                      exclude_defaults=True)
        copy_instance.client_encryption_options.enabled = False
        assert copy_instance.client_encryption_options.enabled is False
        assert original.client_encryption_options.enabled is True
        assert copy_instance != original
        assert copy_instance.dict(
            exclude_unset=True, exclude_defaults=True) != original.dict(
                exclude_unset=True, exclude_defaults=True)

        copy_instance = original.copy()
        copy_instance.client_encryption_options = None
        assert copy_instance != original
        assert copy_instance.dict(
            exclude_unset=True, exclude_defaults=True) != original.dict(
                exclude_unset=True, exclude_defaults=True)
Ejemplo n.º 2
0
 def scylla_yaml(self) -> dict:
     scylla_yaml = ScyllaYaml(
     ) if self.scylla_yaml_raw is None else self.scylla_yaml_raw
     scylla_yaml.cluster_name = self.cluster_name
     if self.bootstrap is not None:
         scylla_yaml.auto_bootstrap = self.bootstrap
     return scylla_yaml.dict(exclude_defaults=True,
                             exclude_none=True,
                             exclude_unset=True)
Ejemplo n.º 3
0
 def scylla_machine_image_json(self) -> str:
     """Specifies configuration file accepted by scylla-machine-image service"""
     if (self.params.get("data_volume_disk_num") or 0) > 0:
         data_device = 'attached'
     else:
         data_device = 'instance_store'
     scylla_yaml = ScyllaYaml()
     scylla_yaml.cluster_name = f"{self.params.get('user_prefix') or DEFAULT_USER_PREFIX}-{self.test_config.test_id()[:8]}"
     smi_payload = {
         "start_scylla_on_first_boot":
         False,
         "data_device":
         data_device,
         "raid_level":
         self.params.get("raid_level") or 0,
         "scylla_yaml":
         scylla_yaml.dict(exclude_defaults=True,
                          exclude_none=True,
                          exclude_unset=True)
     }
     return json.dumps(smi_payload)