Skip to content

Instantly share code, notes, and snippets.

@stof
Created April 2, 2015 23:13
Show Gist options
  • Save stof/873cb799447f388c8bcc to your computer and use it in GitHub Desktop.
Save stof/873cb799447f388c8bcc to your computer and use it in GitHub Desktop.
Behat output for the Datastax driver suite
Feature: SSL encryption
PHP Driver supports SSL encryption.
Scenario: Connecting with basic SSL encryption # features/ssl_encryption.feature:26
php-driver | [ERROR] Connect error 'connection refused' on host 127.0.0.1 (src/connection.cpp:407)
php-driver | [ERROR] Host 127.0.0.1 had the following error on startup: 'Unable to connect' (src/connection.cpp:643)
php-driver | [WARN] Lost connection on host 127.0.0.1 (src/control_connection.cpp:208)
php-driver | [ERROR] Connect error 'connection refused' on host 127.0.0.1 (src/connection.cpp:407)
php-driver | [ERROR] Host 127.0.0.1 had the following error on startup: 'Unable to connect' (src/connection.cpp:643)
php-driver | [WARN] Lost connection on host 127.0.0.1 (src/control_connection.cpp:208)
php-driver | [ERROR] Connect error 'connection refused' on host 127.0.0.1 (src/connection.cpp:407)
php-driver | [ERROR] Host 127.0.0.1 had the following error on startup: 'Unable to connect' (src/connection.cpp:643)
php-driver | [WARN] Lost connection on host 127.0.0.1 (src/control_connection.cpp:208)
Given a running cassandra cluster with SSL encryption # FeatureContext::aRunningCassandraClusterWithSslEncryption()
│ ccm > ccm 'list'
│ ccm > *php-driver-test-cluster
│ ccm > ccm 'stop'
│ ccm > ccm 'updateconf' 'client_encryption_options.enabled: true' 'client_encryption_options.keystore: /usr/local/src/php-driver/support/ssl/.keystore' 'client_encryption_options.keystore_password: php-driver'
│ ccm > ccm 'start' '--wait-other-notice' '--wait-for-binary-proto'
And the following example: # FeatureContext::theFollowingExample()
"""
<?php
$ssl = Cassandra::ssl()
->withVerifyFlags(Cassandra::VERIFY_NONE)
->build();
$cluster = Cassandra::cluster()
->withContactPoints('127.0.0.1')
->withSSL($ssl)
->build();
try {
$session = $cluster->connect();
echo "Connection success\n";
} catch (Cassandra\Exception\RuntimeException $e) {
echo "Connection failure\n";
}
"""
When it is executed # FeatureContext::itIsExecuted()
Then its output should contain: # FeatureContext::itsOutputShouldContain()
"""
Connection success
"""
1 scenario (1 passed)
4 steps (4 passed)
0m11.05s (6.03Mb)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment