Invoke-ServiceFabricFailoverTestScenario

Invokes a test scenario to induce faults in a Service Fabric partition.

Syntax

Invoke-ServiceFabricFailoverTestScenario
      -MaxServiceStabilizationTimeoutSec <UInt32>
      -TimeToRunMinute <UInt32>
      [-WaitTimeBetweenFaultsSec <Int32>]
      -PartitionId <Guid>
      -ServiceName <Uri>
      [-TimeoutSec <Int32>]
      [<CommonParameters>]
Invoke-ServiceFabricFailoverTestScenario
      -MaxServiceStabilizationTimeoutSec <UInt32>
      -TimeToRunMinute <UInt32>
      [-WaitTimeBetweenFaultsSec <Int32>]
      -ServiceName <Uri>
      [-TimeoutSec <Int32>]
      [<CommonParameters>]
Invoke-ServiceFabricFailoverTestScenario
      -MaxServiceStabilizationTimeoutSec <UInt32>
      -TimeToRunMinute <UInt32>
      [-WaitTimeBetweenFaultsSec <Int32>]
      -ServiceName <Uri>
      [-PartitionKindSingleton]
      [-TimeoutSec <Int32>]
      [<CommonParameters>]
Invoke-ServiceFabricFailoverTestScenario
      -MaxServiceStabilizationTimeoutSec <UInt32>
      -TimeToRunMinute <UInt32>
      [-WaitTimeBetweenFaultsSec <Int32>]
      -ServiceName <Uri>
      [-PartitionKindNamed]
      -PartitionKey <String>
      [-TimeoutSec <Int32>]
      [<CommonParameters>]
Invoke-ServiceFabricFailoverTestScenario
      -MaxServiceStabilizationTimeoutSec <UInt32>
      -TimeToRunMinute <UInt32>
      [-WaitTimeBetweenFaultsSec <Int32>]
      -ServiceName <Uri>
      [-PartitionKindUniformInt64]
      -PartitionKey <String>
      [-TimeoutSec <Int32>]
      [<CommonParameters>]

Description

The Invoke-ServiceFabricFailoverTestScenario cmdlet starts a test scenario to induce faults in a Service Fabric partition. The test puts the partition through specific failover scenarios to ensure those paths are exercised. If you run a workload against a Service Fabric service while the cmdlet runs its tests, you increase the chance of discovering bugs in the service.

The faults induced for the primary, secondary, and stateless instances are:

  • RestartReplica (only persisted)
  • RemoveReplica
  • ResartDeployedCodePackage
  • MovePrimary (only stateful)
  • MoveSecondary (only stateful)
  • RestartPartition (no data loss)

Before using this cmdlet, connect to the Service Fabric cluster.

Examples

Example 1: Run a failover test

PS C:\> $TimeToRun = 60
PS C:\> $MaxStabilizationTimeSecs = 180
PS C:\> $WaitTimeBetweenFaultsSec = 10
PS C:\> $ServiceName = "fabric:/SampleApp/SampleService"
PS C:\> Invoke-ServiceFabricFailoverTestScenario -TimeToRunMinute $TimeToRun -MaxServiceStabilizationTimeoutSec $MaxStabilizationTimeSecs -WaitTimeBetweenFaultsSec $WaitTimeBetweenFaultsSec -ServiceName $ServiceName -PartitionKindSingleton

Parameters

-MaxServiceStabilizationTimeoutSec

Specifies the maximum time-out period, in seconds, for the service to stabilize before failing the test.

Type:UInt32
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-PartitionId

Specifies the ID of the partition to test.

Type:Guid
Position:Named
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-PartitionKey

Specifies the key of the partition on which to invoke the test.

Type:String
Position:Named
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-PartitionKindNamed

Indicates that this cmdlet tests a named partition.

Type:SwitchParameter
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-PartitionKindSingleton

Indicates that this cmdlet tests a singleton partition.

Type:SwitchParameter
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-PartitionKindUniformInt64

Indicates that this cmdlet tests a UniformInt64 partitioned service.

Type:SwitchParameter
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-ServiceName

Specifies the name of the service to test.

Type:Uri
Position:Named
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-TimeoutSec

Specifies the time-out period, in seconds, for the operation.

Type:Int32
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-TimeToRunMinute

Specifies the total time, in minutes, for the scenario to run.

Type:UInt32
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-WaitTimeBetweenFaultsSec

Specifies the maximum wait time, in seconds, between consecutive faults. The larger the value the lower the concurrency.

Type:Int32
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

Inputs

System.Guid

System.Uri

System.String

Outputs

System.Object