\SmokeTestPipelineStep
Class SmokeTestPipelineTest This class performs a 'smoke test' against a {@link DNEnvironment}. This smoke test is specific to the environment, but generally consists of: - Checking the homepage (and other key pages, if specified) for a HTTP response 'Status' code of 200 - Perhaps checking 'dev/check' for sites that include the environmentcheck module ({@see https://github.com/silverstripe-labs/silverstripe-environmentcheck}).
Note that this step can also be reused as a special conditional smoke test configured on the Pipeline itself - see
the Pipeline documentation for details. You should override the "Tests" configuration variable on the Pipeline
otherwise it will use the default: hit the homepage and expect 200.
<code>
Pipeline:
Tests: # Used by both rollback and smoke test
Home:
URL: http://www.mysite.com/
Videos:
URL: http://www.mysite.com/videos/
Attempts: 1 # This test should only be attempted once
Steps:
SmokeTest:
Class: SmokeTestPipelineStep
MaxDuration: 3600
RequestTimeout: 13
Attempts: 2 # Tests get 2 attempts each
Tests: # Tests only used by deployment smoketest
ExtraTest:
URL: http://www.mysite.com/another/
RollbackStep2:
Class: SmokeTestPipelineStep
Attempts: 3 # Allow more attempts on rollback
Tests: # Tests only used by rollback smoketest
RollbackTest:
URL: http://www.mysite.com/check-status/
</code>
Synopsis
- // members
- private static array $default_config = ;
- private static array $bad_status_codes = ;
- // Inherited members from PipelineStep
- protected $mergedConfig;
- // methods
- protected array getTests()
- protected resource initCurl()
- public bool runTest()
- public void start()
- public void markFailed()
- // Inherited methods from PipelineStep
- public string getTitle()
- public void getTreeTitle()
- public void getNiceName()
- public array getConfigData()
- public void setConfig()
- public string getRunningDescription()
- public mixed getConfigSetting()
- public void finish()
- public void markFailed()
- public boolean isQueued()
- public boolean isRunning()
- public boolean isFinished()
- public boolean isFailed()
- public boolean isAborted()
- public void log()
- protected DNEnvironment getDependentEnvironment()
- public boolean start()
- public boolean abort()
- public array allowedActions()
- public void getDryRun()
Hierarchy
Extends
Members
private
- $bad_status_codes — array
- $default_config
—
array
Default config setting
protected
- $mergedConfig
—
array
Cached of config merged with defaults
Methods
protected
- getTests() — Get all tests to be run by this smoketest
- initCurl() — Initialiase curl handle
public
- markFailed()
- runTest() — Run a single test
- start()
Inherited from PipelineStep
protected
- getDependentEnvironment() — Tries to look up the value of the 'PerformTestOn' yml key for this step, and return the {@link DNEnvironment} that the key refers to, if set.
public
- abort() — Abort the step immediately, regardless of its current state, performing any cleanup necessary.
- allowedActions() — List of allowed actions the user is all allowed to take on this step
- finish()
- getConfigData() — Unserializes a snippet of configuration that was saved at the time this step was created at {@link Pipeline::start()} so that this step can use that configuration to determine what it needs to do. e.g for SmokeTestPipelineStep this might contain a list of URLs that need to be checked and which status codes to check for.
- getConfigSetting() — Retrieve the value of a specific config setting
- getDryRun()
- getNiceName()
- getRunningDescription() — Describe what the step is currently doing.
- getTitle() — Title of this step
- getTreeTitle()
- isAborted() — Determine if the step has been aborted (Aborted state).
- isFailed() — Determine if the step has failed on its own (Failed state). No further state transitions may occur.
- isFinished() — Determine if this step is in progress (Started state).
- isQueued() — Determine if this step is in progress (Started state).
- isRunning() — Determine if this step is in progress (Started state).
- log() — Log a message to the current log
- markFailed() — Fail this pipeline step
- setConfig()
- start() — Initialise the step unless it's already running (Started state).