Share via


Invoke-ServiceFabricFailoverTestScenario

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

Syntax

PartitionId

Invoke-ServiceFabricFailoverTestScenario
    -MaxServiceStabilizationTimeoutSec <UInt32>
    -TimeToRunMinute <UInt32>
    -PartitionId <Guid>
    -ServiceName <Uri>
    [-WaitTimeBetweenFaultsSec <Int32>]
    [-TimeoutSec <Int32>]
    [<CommonParameters>]

ServiceNameRandomPartition

Invoke-ServiceFabricFailoverTestScenario
    -MaxServiceStabilizationTimeoutSec <UInt32>
    -TimeToRunMinute <UInt32>
    -ServiceName <Uri>
    [-WaitTimeBetweenFaultsSec <Int32>]
    [-TimeoutSec <Int32>]
    [<CommonParameters>]

ServiceNamePartitionSingleton

Invoke-ServiceFabricFailoverTestScenario
    -MaxServiceStabilizationTimeoutSec <UInt32>
    -TimeToRunMinute <UInt32>
    -ServiceName <Uri>
    [-WaitTimeBetweenFaultsSec <Int32>]
    [-PartitionKindSingleton]
    [-TimeoutSec <Int32>]
    [<CommonParameters>]

ServiceNamePartitionNamed

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

ServiceNamePartitionUniformedInt

Invoke-ServiceFabricFailoverTestScenario
    -MaxServiceStabilizationTimeoutSec <UInt32>
    -TimeToRunMinute <UInt32>
    -ServiceName <Uri>
    -PartitionKey <String>
    [-WaitTimeBetweenFaultsSec <Int32>]
    [-PartitionKindUniformInt64]
    [-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.

Parameter properties

Type:UInt32
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-PartitionId

Specifies the ID of the partition to test.

Parameter properties

Type:Guid
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

PartitionId
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-PartitionKey

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

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

ServiceNamePartitionNamed
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False
ServiceNamePartitionUniformedInt
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-PartitionKindNamed

Indicates that this cmdlet tests a named partition.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

ServiceNamePartitionNamed
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-PartitionKindSingleton

Indicates that this cmdlet tests a singleton partition.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

ServiceNamePartitionSingleton
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-PartitionKindUniformInt64

Indicates that this cmdlet tests a UniformInt64 partitioned service.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

ServiceNamePartitionUniformedInt
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-ServiceName

Specifies the name of the service to test.

Parameter properties

Type:Uri
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-TimeoutSec

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

Parameter properties

Type:Int32
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-TimeToRunMinute

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

Parameter properties

Type:UInt32
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-WaitTimeBetweenFaultsSec

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

Parameter properties

Type:Int32
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

Inputs

System.Guid

System.Uri

System.String

Outputs

System.Object