@Test public void removeNetworkTagsSelfHealing () { doReturn(new GcpComputePlatform.Fingerprint<>("fingerprint", List.of("old-tag"))).when(platform) .getFirewallTags(container); container.removeNetworkTags(experiment); experiment.getSelfHealingMethod().run(); verify(platform).setTags(container, List.of("old-tag")); }
@ChaosExperiment(experimentType = ExperimentType.NETWORK, experimentScope = ExperimentScope.PET) public void removeNetworkTags (Experiment experiment) { GcpComputePlatform.Fingerprint<List<String>> listFingerprint = fetchFirewallTags(); List<String> originalTags = listFingerprint.get(); String oldFingerprint = listFingerprint.getFingerprint(); AtomicReference<String> operationId = new AtomicReference<>(); experiment.setCheckContainerHealth(() -> isOperationComplete(operationId) && platform.checkTags(this, originalTags) ? ContainerHealth.NORMAL : ContainerHealth.RUNNING_EXPERIMENT); experiment.setSelfHealingMethod(() -> platform.setTags(this, originalTags)); operationId.set(platform.setTagsSafe(this, List.of(), oldFingerprint)); }
GcpComputeInstanceContainer extends Container { @ChaosExperiment(experimentType = ExperimentType.NETWORK, experimentScope = ExperimentScope.PET) public void removeNetworkTags (Experiment experiment) { GcpComputePlatform.Fingerprint<List<String>> listFingerprint = fetchFirewallTags(); List<String> originalTags = listFingerprint.get(); String oldFingerprint = listFingerprint.getFingerprint(); AtomicReference<String> operationId = new AtomicReference<>(); experiment.setCheckContainerHealth(() -> isOperationComplete(operationId) && platform.checkTags(this, originalTags) ? ContainerHealth.NORMAL : ContainerHealth.RUNNING_EXPERIMENT); experiment.setSelfHealingMethod(() -> platform.setTags(this, originalTags)); operationId.set(platform.setTagsSafe(this, List.of(), oldFingerprint)); } }
GcpComputeInstanceContainer extends Container { @ChaosExperiment(experimentType = ExperimentType.NETWORK, experimentScope = ExperimentScope.PET) public void removeNetworkTags (Experiment experiment) { GcpComputePlatform.Fingerprint<List<String>> listFingerprint = fetchFirewallTags(); List<String> originalTags = listFingerprint.get(); String oldFingerprint = listFingerprint.getFingerprint(); AtomicReference<String> operationId = new AtomicReference<>(); experiment.setCheckContainerHealth(() -> isOperationComplete(operationId) && platform.checkTags(this, originalTags) ? ContainerHealth.NORMAL : ContainerHealth.RUNNING_EXPERIMENT); experiment.setSelfHealingMethod(() -> platform.setTags(this, originalTags)); operationId.set(platform.setTagsSafe(this, List.of(), oldFingerprint)); } private  GcpComputeInstanceContainer(); }
GcpComputeInstanceContainer extends Container { @ChaosExperiment(experimentType = ExperimentType.NETWORK, experimentScope = ExperimentScope.PET) public void removeNetworkTags (Experiment experiment) { GcpComputePlatform.Fingerprint<List<String>> listFingerprint = fetchFirewallTags(); List<String> originalTags = listFingerprint.get(); String oldFingerprint = listFingerprint.getFingerprint(); AtomicReference<String> operationId = new AtomicReference<>(); experiment.setCheckContainerHealth(() -> isOperationComplete(operationId) && platform.checkTags(this, originalTags) ? ContainerHealth.NORMAL : ContainerHealth.RUNNING_EXPERIMENT); experiment.setSelfHealingMethod(() -> platform.setTags(this, originalTags)); operationId.set(platform.setTagsSafe(this, List.of(), oldFingerprint)); } private  GcpComputeInstanceContainer(); static GcpComputeInstanceContainerBuilder builder(); String getUniqueIdentifier(); @ChaosExperiment(experimentType = ExperimentType.STATE, experimentScope = ExperimentScope.CATTLE, maximumDurationInSeconds = 600) void recreateInstanceInGroup(Experiment experiment); String getInstanceName(); String getZone(); @Override Platform getPlatform(); @Override String getSimpleName(); @Override String getAggregationIdentifier(); @Override DataDogIdentifier getDataDogIdentifier(); @Override boolean isCattle(); @ChaosExperiment(experimentType = ExperimentType.NETWORK, experimentScope = ExperimentScope.PET) void removeNetworkTags(Experiment experiment); @ChaosExperiment(experimentType = ExperimentType.RESOURCE, maximumDurationInSeconds = 600) void simulateMaintenance(Experiment experiment); @ChaosExperiment(experimentType = ExperimentType.STATE, experimentScope = ExperimentScope.PET) void stopInstance(Experiment experiment); @ChaosExperiment(experimentType = ExperimentType.STATE, experimentScope = ExperimentScope.PET) void resetInstance(Experiment experiment); GcpSSHKeyMetadata getGcpSSHKeyMetadata(); void updateUUID(); SSHCredentials getSSHCredentials(); String getSSHEndpoint(); @Override boolean supportsShellBasedExperiments(); }
GcpComputeInstanceContainer extends Container { @ChaosExperiment(experimentType = ExperimentType.NETWORK, experimentScope = ExperimentScope.PET) public void removeNetworkTags (Experiment experiment) { GcpComputePlatform.Fingerprint<List<String>> listFingerprint = fetchFirewallTags(); List<String> originalTags = listFingerprint.get(); String oldFingerprint = listFingerprint.getFingerprint(); AtomicReference<String> operationId = new AtomicReference<>(); experiment.setCheckContainerHealth(() -> isOperationComplete(operationId) && platform.checkTags(this, originalTags) ? ContainerHealth.NORMAL : ContainerHealth.RUNNING_EXPERIMENT); experiment.setSelfHealingMethod(() -> platform.setTags(this, originalTags)); operationId.set(platform.setTagsSafe(this, List.of(), oldFingerprint)); } private  GcpComputeInstanceContainer(); static GcpComputeInstanceContainerBuilder builder(); String getUniqueIdentifier(); @ChaosExperiment(experimentType = ExperimentType.STATE, experimentScope = ExperimentScope.CATTLE, maximumDurationInSeconds = 600) void recreateInstanceInGroup(Experiment experiment); String getInstanceName(); String getZone(); @Override Platform getPlatform(); @Override String getSimpleName(); @Override String getAggregationIdentifier(); @Override DataDogIdentifier getDataDogIdentifier(); @Override boolean isCattle(); @ChaosExperiment(experimentType = ExperimentType.NETWORK, experimentScope = ExperimentScope.PET) void removeNetworkTags(Experiment experiment); @ChaosExperiment(experimentType = ExperimentType.RESOURCE, maximumDurationInSeconds = 600) void simulateMaintenance(Experiment experiment); @ChaosExperiment(experimentType = ExperimentType.STATE, experimentScope = ExperimentScope.PET) void stopInstance(Experiment experiment); @ChaosExperiment(experimentType = ExperimentType.STATE, experimentScope = ExperimentScope.PET) void resetInstance(Experiment experiment); GcpSSHKeyMetadata getGcpSSHKeyMetadata(); void updateUUID(); SSHCredentials getSSHCredentials(); String getSSHEndpoint(); @Override boolean supportsShellBasedExperiments(); static final String DATADOG_IDENTIFIER_KEY; }