Invoke-​Service​Fabric​Failover​Test​Scenario

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

Syntax

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

Required 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
Accept pipeline input:False
Accept wildcard characters:False
-PartitionId

Specifies the ID of the partition to test.

Type:Guid
Position:Named
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False
-PartitionKey

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

Type:String
Position:Named
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False
-PartitionKindNamed

Indicates that this cmdlet tests a named partition.

Type:SwitchParameter
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-PartitionKindSingleton

Indicates that this cmdlet tests a singleton partition.

Type:SwitchParameter
Position:Named
Default value:None
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
Accept pipeline input:False
Accept wildcard characters:False
-ServiceName

Specifies the name of the service to test.

Type:Uri
Position:Named
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False
-TimeToRunMinute

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

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

Optional Parameters

-TimeoutSec

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

Type:Int32
Position:Named
Default value:None
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
Accept pipeline input:False
Accept wildcard characters:False

Inputs

System.Guid

Inputs

System.Uri

Outputs

System.Object