• Aucun résultat trouvé

5. Security Incident Handling

5.2 Notification and Points of Contact

IFAILUREMANAGER

Este Apêndice apresenta a interface IFailureManager, exposta pelo OctopusController que tem como intenção fornecer ao engenheiro de testes um conjunto de funções que o auxiliem a facilmente introduzir falhas nos testes para verificar o comportamento das aplicações em teste.

Abaixo está o código da interface na linguagem de programação C# com comentários realizados na língua inglesa.

using System;

namespace Octopus {

/// <summary>

/// Interface exposed by the OctopusController, allowing the

/// test engineer to cause failures during a test run and

/// observe the applications behavior.

/// </summary>

public interface IFailureManager

{

/// <summary>

/// Kill a specific process

/// </summary>

/// <param name="processName">Name of the process to be killed</param>

void KillProcess(string processName); /// <summary>

/// Shuts a machine down

/// </summary>

/// <param name="machineName">Machine to be shutdown</param>

/// <param name="restart">True if should restart the machine, else otherwise</param>

void ShutdownMachine(string machineName, bool restart); /// <summary>

/// Releases the IP of a machine disconnecting it from

/// the network

/// </summary>

/// <param name="machineName">Machine to be disconnected</param> /// <param name="restart">True if should renew IP, else otherwise</param>

/// <param name="restartTime">Time to wait before restarting</param>

void ShutdownNetwork(string machineName, bool restart, TimeSpan restartTime);

/// <summary>

/// Sets the machine clock to a specific time

/// </summary>

/// <param name="machineName">Name of the machine</param> /// <param name="dateTime">Time to set the clock to</param> void SetClockToTime(string machineName, DateTime dateTime);

APÊNDICES

/// <summary>

/// Sets the machine clock to a random time

/// </summary>

/// <param name="machineName">Name of the machine</param>

/// <param name="before">True if random time should be before current time, else otherwise</param>

void SetClockToRandomTime(string machineName, bool before); /// <summary>

/// Simulates a full disk on a remote machine

/// </summary>

/// <param name="machineName">Name of the machine</param> void FloodDisk(string machineName);

/// <summary>

/// Starts several infinite loop threads in a remote

/// machine to flood the processor

/// </summary>

/// <param name="machineName">Name of the machine</param> void FloodProcessor(string machineName);

/// <summary>

/// Allocates several large blocks of memory

/// in the remote machine

/// </summary>

/// <param name="machineName">Name of the machine</param> void FloodMemory(string machineName);

} }

APÊNDICES

capítulo 12

APÊNDICE E: EXEMPLO DE ARQUIVO DE

CONFIGURAÇÃO COMPLETO

Este apêndice apresenta um exemplo de arquivo de configuração do framework Octopus utilizado em testes com 8 máquinas e 3 papéis.

<?xml version="1.0"?>

<OctopusConfiguration>

<TestParameters> <TestParameter>

<Key>MessageSize</Key> <Value>1024</Value> </TestParameter> <TestParameter>

<Key>MessageRate</Key> <Value>32</Value> </TestParameter> <TestParameter>

<Key>TestDuration</Key> <Value>600</Value> </TestParameter> <TestParameter>

<Key>IncrementConsumerInterval</Key> <Value>30</Value>

</TestParameter> <TestParameter>

<Key>FailureTime</Key> <Value>20</Value> </TestParameter> </TestParameters> <MachineRoles>

<MachineRole RoleName="TopicServer"> <ProcessInfos>

<ProcessInfo>

<ProcessName>TopicServer</ProcessName> <TaskExecutors>

<RemoteTaskExecutor>

<Name>TopicServerTaskExecutor</Name> <TypeName>PublishSubscribeTests.TopicServerTaskExecutor</TypeName> </RemoteTaskExecutor> </TaskExecutors> </ProcessInfo> </ProcessInfos> <Dependencies> <Dependency Path="D:\_projetos\octopusframework\PublishSubscribeTests\bin\Debug\Publish Subscribe.dll" DestinationPath="" Principal="false" />

<Dependency

Path="D:\_projetos\octopusframework\PublishSubscribeTests\bin\Debug\Publish SubscribeTests.dll" DestinationPath="" Principal="true" />

</Dependencies> <MachineRequirements> <MinimumProcessorFrequency>1</MinimumProcessorFrequency> <MinimumAvailableMemory>0</MinimumAvailableMemory> <MinimumFreeDiskSpace>1024</MinimumFreeDiskSpace> </MachineRequirements> </MachineRole>

APÊNDICES

<ProcessInfos> <ProcessInfo>

<ProcessName>Producer</ProcessName> <TaskExecutors>

<RemoteTaskExecutor>

<Name>ProducerTaskExecutor</Name> <TypeName>PublishSubscribeTests.ProducerTaskExecutor</TypeName> </RemoteTaskExecutor> </TaskExecutors> </ProcessInfo> </ProcessInfos> <Dependencies> <Dependency Path="D:\_projetos\octopusframework\PublishSubscribeTests\bin\Debug\Publish SubscribeTests.dll" DestinationPath="" Principal="true" />

<Dependency

Path="D:\_projetos\octopusframework\PublishSubscribeTests\bin\Debug\Publish Subscribe.dll" DestinationPath="" Principal="false" />

</Dependencies> <MachineRequirements> <MinimumProcessorFrequency>0</MinimumProcessorFrequency> <MinimumAvailableMemory>0</MinimumAvailableMemory> <MinimumFreeDiskSpace>0</MinimumFreeDiskSpace> </MachineRequirements> </MachineRole>

<MachineRole RoleName="Consumer"> <ProcessInfos>

<ProcessInfo>

<ProcessName>Consumer</ProcessName> <TaskExecutors>

<RemoteTaskExecutor>

<Name>ConsumerTaskExecutor</Name> <TypeName>PublishSubscribeTests.ConsumerTaskExecutor</TypeName> </RemoteTaskExecutor> </TaskExecutors> </ProcessInfo> </ProcessInfos> <Dependencies> <Dependency Path="D:\_projetos\octopusframework\PublishSubscribeTests\bin\Debug\Publish SubscribeTests.dll" DestinationPath="" Principal="true" />

<Dependency

Path="D:\_projetos\octopusframework\PublishSubscribeTests\bin\Debug\Publish Subscribe.dll" DestinationPath="" Principal="false" />

</Dependencies> <MachineRequirements> <MinimumProcessorFrequency>0</MinimumProcessorFrequency> <MinimumAvailableMemory>0</MinimumAvailableMemory> <MinimumFreeDiskSpace>0</MinimumFreeDiskSpace> </MachineRequirements> </MachineRole> </MachineRoles> <RemoteMachines>

<RemoteMachine HostName="RENATO"> <MachineRoleNames>

<RoleName>Producer</RoleName> </MachineRoleNames>

<Parameters /> </RemoteMachine>

<RemoteMachine HostName="APOCALIPSE"> <MachineRoleNames>

APÊNDICES

<RoleName>TopicServer</RoleName> </MachineRoleNames>

<Parameters /> </RemoteMachine>

<RemoteMachine HostName="OMEGARED"> <MachineRoleNames>

<RoleName>TopicServer</RoleName> </MachineRoleNames>

<Parameters /> </RemoteMachine>

<RemoteMachine HostName="VENOM"> <MachineRoleNames>

<RoleName>Consumer</RoleName> </MachineRoleNames>

<Parameters /> </RemoteMachine>

<RemoteMachine HostName="GALACTUS"> <MachineRoleNames>

<RoleName>Consumer</RoleName> </MachineRoleNames>

<Parameters /> </RemoteMachine>

<RemoteMachine HostName="STORM"> <MachineRoleNames>

<RoleName>Producer</RoleName> </MachineRoleNames>

<Parameters /> </RemoteMachine>

<RemoteMachine HostName="DARKSEID"> <MachineRoleNames>

<RoleName>Consumer</RoleName> </MachineRoleNames>

<Parameters /> </RemoteMachine>

<RemoteMachine HostName="WOLVERINE"> <MachineRoleNames>

<RoleName>Consumer</RoleName> </MachineRoleNames>

<Parameters /> </RemoteMachine> </RemoteMachines> <PerfCounters>

<PerfCounterInfo Category="PubSubConsumer" Counter="Messages Consumed" Instance="" AggregationStyle="Average" />

<PerfCounterInfo Category="PubSubProducer" Counter="Messages Produced" Instance="" AggregationStyle="Average" />

<PerfCounterInfo Category="PubSubServer" Counter="Messages Received" Instance="" AggregationStyle="Average" />

<PerfCounterInfo Category="PubSubServer" Counter="Messages Served" Instance="" AggregationStyle="Average" />

</PerfCounters>