Skip to content

Commit

Permalink
fix(tests): Replace ::cassandra by cassandra::
Browse files Browse the repository at this point in the history
Inside relationship checks, Exec[::cassandra...]  causes test issues.
Replace with the correct syntax, Exec[cassandra...]
  • Loading branch information
jsczek committed Jul 15, 2024
1 parent 237c681 commit 0ab8798
Show file tree
Hide file tree
Showing 7 changed files with 42 additions and 38 deletions.
12 changes: 6 additions & 6 deletions spec/classes/schema_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@

read_command = '/usr/bin/cqlsh -e \'DESC KEYSPACES\' localhost 9042'

expect(subject).to contain_exec('::cassandra::schema connection test').
expect(subject).to contain_exec('cassandra::schema connection test').
only_with(command: read_command,
returns: 0,
tries: 6,
Expand Down Expand Up @@ -78,7 +78,7 @@

read_command = '/usr/bin/scl enable testscl "/usr/bin/cqlsh -e \'DESC KEYSPACES\' localhost 9042"'

expect(subject).to contain_exec('::cassandra::schema connection test').
expect(subject).to contain_exec('cassandra::schema connection test').
only_with(command: read_command,
returns: 0,
tries: 6,
Expand Down Expand Up @@ -125,11 +125,11 @@
mode: '0600',
owner: 0,
content: %r{username = cassandra}
).that_comes_before('Exec[::cassandra::schema connection test]')
).that_comes_before('Exec[cassandra::schema connection test]')

read_command = "/usr/bin/cqlsh --cqlshrc=/root/.puppetcqlshrc -e 'DESC KEYSPACES' localhost 9042"

expect(subject).to contain_exec('::cassandra::schema connection test').
expect(subject).to contain_exec('cassandra::schema connection test').
only_with(command: read_command,
returns: 0,
tries: 6,
Expand Down Expand Up @@ -181,7 +181,7 @@

read_command = "/usr/bin/cqlsh --cqlshrc=/root/.puppetcqlshrc -e 'DESC KEYSPACES' localhost 9042"

expect(subject).to contain_exec('::cassandra::schema connection test').
expect(subject).to contain_exec('cassandra::schema connection test').
only_with(command: read_command,
returns: 0,
tries: 6,
Expand Down Expand Up @@ -216,7 +216,7 @@
it do
read_command = "/usr/bin/cqlsh -u cassandra -p topsecret -e 'DESC KEYSPACES' localhost 9042"

expect(subject).to contain_exec('::cassandra::schema connection test').
expect(subject).to contain_exec('cassandra::schema connection test').
only_with(command: read_command,
returns: 0,
tries: 6,
Expand Down
8 changes: 4 additions & 4 deletions spec/defines/schema/cql_type_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
exec_command += '(firstname text, lastname text)" localhost 9042'
expect(subject).to contain_exec(exec_command).
only_with(unless: read_command,
require: 'Exec[::cassandra::schema connection test]')
require: 'Exec[cassandra::schema connection test]')
end
end

Expand Down Expand Up @@ -89,7 +89,7 @@
exec_command += '(firstname text, lastname text)\" localhost 9042"'
expect(subject).to contain_exec(exec_command).
only_with(unless: read_command,
require: 'Exec[::cassandra::schema connection test]')
require: 'Exec[cassandra::schema connection test]')
end
end

Expand Down Expand Up @@ -127,7 +127,7 @@
exec_command = '/usr/bin/cqlsh -e "DROP type Excalibur.address" localhost 9042'
expect(subject).to contain_exec(exec_command).
only_with(onlyif: read_command,
require: 'Exec[::cassandra::schema connection test]')
require: 'Exec[cassandra::schema connection test]')
end
end

Expand Down Expand Up @@ -165,7 +165,7 @@
exec_command = '/usr/bin/scl enable testscl "/usr/bin/cqlsh -e \"DROP type Excalibur.address\" localhost 9042"'
expect(subject).to contain_exec(exec_command).
only_with(onlyif: read_command,
require: 'Exec[::cassandra::schema connection test]')
require: 'Exec[cassandra::schema connection test]')
end
end

Expand Down
16 changes: 8 additions & 8 deletions spec/defines/schema/index_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
exec_command = '/usr/bin/cqlsh -e "CREATE INDEX IF NOT EXISTS user_index ON mykeyspace.users (lname)" localhost 9042'
expect(subject).to contain_exec(exec_command).
only_with(unless: read_command,
require: 'Exec[::cassandra::schema connection test]')
require: 'Exec[cassandra::schema connection test]')
end
end

Expand Down Expand Up @@ -79,7 +79,7 @@
exec_command = '/usr/bin/scl enable testscl "/usr/bin/cqlsh -e \"CREATE INDEX IF NOT EXISTS user_index ON mykeyspace.users (lname)\" localhost 9042"'
expect(subject).to contain_exec(exec_command).
only_with(unless: read_command,
require: 'Exec[::cassandra::schema connection test]')
require: 'Exec[cassandra::schema connection test]')
end
end

Expand Down Expand Up @@ -119,7 +119,7 @@
exec_command = '/usr/bin/cqlsh -e "CREATE CUSTOM INDEX IF NOT EXISTS user_index ON Excelsior.users (email) USING \'path.to.the.IndexClass\'" localhost 9042'
expect(subject).to contain_exec(exec_command).
only_with(unless: read_command,
require: 'Exec[::cassandra::schema connection test]')
require: 'Exec[cassandra::schema connection test]')
end
end

Expand Down Expand Up @@ -159,7 +159,7 @@
exec_command = '/usr/bin/scl enable testscl "/usr/bin/cqlsh -e \"CREATE CUSTOM INDEX IF NOT EXISTS user_index ON Excelsior.users (email) USING \'path.to.the.IndexClass\'\" localhost 9042"'
expect(subject).to contain_exec(exec_command).
only_with(unless: read_command,
require: 'Exec[::cassandra::schema connection test]')
require: 'Exec[cassandra::schema connection test]')
end
end

Expand Down Expand Up @@ -202,7 +202,7 @@
exec_command += '\'storage\': \'/mnt/ssd/indexes/\'}" localhost 9042'
expect(subject).to contain_exec(exec_command).
only_with(unless: read_command,
require: 'Exec[::cassandra::schema connection test]')
require: 'Exec[cassandra::schema connection test]')
end
end

Expand Down Expand Up @@ -245,7 +245,7 @@
exec_command += '\'storage\': \'/mnt/ssd/indexes/\'}\" localhost 9042"'
expect(subject).to contain_exec(exec_command).
only_with(unless: read_command,
require: 'Exec[::cassandra::schema connection test]')
require: 'Exec[cassandra::schema connection test]')
end
end

Expand Down Expand Up @@ -285,7 +285,7 @@
exec_command = '/usr/bin/cqlsh -e "DROP INDEX Excelsior.user_index" localhost 9042'
expect(subject).to contain_exec(exec_command).
only_with(onlyif: read_command,
require: 'Exec[::cassandra::schema connection test]')
require: 'Exec[cassandra::schema connection test]')
end
end

Expand Down Expand Up @@ -325,7 +325,7 @@
exec_command = '/usr/bin/scl enable testscl "/usr/bin/cqlsh -e \"DROP INDEX Excelsior.user_index\" localhost 9042"'
expect(subject).to contain_exec(exec_command).
only_with(onlyif: read_command,
require: 'Exec[::cassandra::schema connection test]')
require: 'Exec[cassandra::schema connection test]')
end
end

Expand Down
12 changes: 6 additions & 6 deletions spec/defines/schema/keyspace_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
exec_command += 'AND DURABLE_WRITES = true" localhost 9042'
expect(subject).to contain_exec(exec_command).
only_with(unless: read_command,
require: 'Exec[::cassandra::schema connection test]')
require: 'Exec[cassandra::schema connection test]')
end
end

Expand Down Expand Up @@ -88,7 +88,7 @@
exec_command += 'AND DURABLE_WRITES = true\" localhost 9042"'
expect(subject).to contain_exec(exec_command).
only_with(unless: read_command,
require: 'Exec[::cassandra::schema connection test]')
require: 'Exec[cassandra::schema connection test]')
end
end

Expand Down Expand Up @@ -133,7 +133,7 @@
exec_command += 'AND DURABLE_WRITES = true" localhost 9042'
expect(subject).to contain_exec(exec_command).
only_with(unless: read_command,
require: 'Exec[::cassandra::schema connection test]')
require: 'Exec[cassandra::schema connection test]')
end
end

Expand Down Expand Up @@ -178,7 +178,7 @@
exec_command += 'AND DURABLE_WRITES = true\" localhost 9042"'
expect(subject).to contain_exec(exec_command).
only_with(unless: read_command,
require: 'Exec[::cassandra::schema connection test]')
require: 'Exec[cassandra::schema connection test]')
end
end

Expand Down Expand Up @@ -214,7 +214,7 @@
exec_command = '/usr/bin/cqlsh -e "DROP KEYSPACE foobar" localhost 9042'
expect(subject).to contain_exec(exec_command).
only_with(onlyif: read_command,
require: 'Exec[::cassandra::schema connection test]')
require: 'Exec[cassandra::schema connection test]')
end
end

Expand Down Expand Up @@ -250,7 +250,7 @@
exec_command = '/usr/bin/scl enable testscl "/usr/bin/cqlsh -e \"DROP KEYSPACE foobar\" localhost 9042"'
expect(subject).to contain_exec(exec_command).
only_with(onlyif: read_command,
require: 'Exec[::cassandra::schema connection test]')
require: 'Exec[cassandra::schema connection test]')
end
end

Expand Down
20 changes: 10 additions & 10 deletions spec/defines/schema/permission_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
expect(subject).to contain_exec(script_command).
only_with(command: exec_command,
unless: read_script,
require: 'Exec[::cassandra::schema connection test]')
require: 'Exec[cassandra::schema connection test]')
end
end

Expand All @@ -81,7 +81,7 @@
expect(subject).to contain_exec(script_command).
only_with(command: exec_command,
unless: read_script,
require: 'Exec[::cassandra::schema connection test]')
require: 'Exec[cassandra::schema connection test]')
end
end

Expand All @@ -108,7 +108,7 @@
expect(subject).to contain_exec(script_command).
only_with(command: exec_command,
unless: read_script,
require: 'Exec[::cassandra::schema connection test]')
require: 'Exec[cassandra::schema connection test]')
end
end

Expand All @@ -135,7 +135,7 @@
expect(subject).to contain_exec(script_command).
only_with(command: exec_command,
unless: read_script,
require: 'Exec[::cassandra::schema connection test]')
require: 'Exec[cassandra::schema connection test]')
end
end

Expand All @@ -162,7 +162,7 @@
expect(subject).to contain_exec(script_command).
only_with(command: exec_command,
unless: read_script,
require: 'Exec[::cassandra::schema connection test]')
require: 'Exec[cassandra::schema connection test]')
end
end

Expand All @@ -189,7 +189,7 @@
expect(subject).to contain_exec(script_command).
only_with(command: exec_command,
unless: read_script,
require: 'Exec[::cassandra::schema connection test]')
require: 'Exec[cassandra::schema connection test]')
end
end

Expand Down Expand Up @@ -231,7 +231,7 @@
expect(subject).to contain_exec(script_command).
only_with(command: exec_command,
unless: read_script,
require: 'Exec[::cassandra::schema connection test]')
require: 'Exec[cassandra::schema connection test]')
end
end
end
Expand Down Expand Up @@ -274,7 +274,7 @@
expect(subject).to contain_exec(script_command).
only_with(command: exec_command,
unless: read_script,
require: 'Exec[::cassandra::schema connection test]')
require: 'Exec[cassandra::schema connection test]')
end
end
end
Expand Down Expand Up @@ -303,7 +303,7 @@
expect(subject).to contain_exec(script_command).
only_with(command: exec_command,
onlyif: read_script,
require: 'Exec[::cassandra::schema connection test]')
require: 'Exec[cassandra::schema connection test]')
end
end

Expand Down Expand Up @@ -331,7 +331,7 @@
expect(subject).to contain_exec(script_command).
only_with(command: exec_command,
onlyif: read_script,
require: 'Exec[::cassandra::schema connection test]')
require: 'Exec[cassandra::schema connection test]')
end
end
end
Expand Down
8 changes: 4 additions & 4 deletions spec/defines/schema/table_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
exec_command += 'WITH COMPACT STORAGE AND ID=\'5a1c395e-b41f-11e5-9f22-ba0be0483c18\'" localhost 9042'
expect(subject).to contain_exec(exec_command).
only_with(unless: read_command,
require: 'Exec[::cassandra::schema connection test]')
require: 'Exec[cassandra::schema connection test]')
end
end

Expand Down Expand Up @@ -111,7 +111,7 @@
exec_command += 'WITH COMPACT STORAGE AND ID=\'5a1c395e-b41f-11e5-9f22-ba0be0483c18\'\" localhost 9042"'
expect(subject).to contain_exec(exec_command).
only_with(unless: read_command,
require: 'Exec[::cassandra::schema connection test]')
require: 'Exec[cassandra::schema connection test]')
end
end

Expand Down Expand Up @@ -149,7 +149,7 @@
exec_command = '/usr/bin/cqlsh -e "DROP TABLE IF EXISTS Excelsior.users" localhost 9042'
expect(subject).to contain_exec(exec_command).
only_with(onlyif: read_command,
require: 'Exec[::cassandra::schema connection test]')
require: 'Exec[cassandra::schema connection test]')
end
end

Expand Down Expand Up @@ -186,7 +186,7 @@
exec_command = '/usr/bin/scl enable testscl "/usr/bin/cqlsh -e \"DROP TABLE IF EXISTS Excelsior.users\" localhost 9042"'
expect(subject).to contain_exec(exec_command).
only_with(onlyif: read_command,
require: 'Exec[::cassandra::schema connection test]')
require: 'Exec[cassandra::schema connection test]')
end
end

Expand Down
4 changes: 4 additions & 0 deletions spec/defines/schema/user_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@
# Title is essential to set the username.
let(:title) { 'bob' }

# As much as possible, parameters have been left default.
# This will serve as a massive red flag should defaults unexpectedly change.
# In the past parameters were often overriden, which both duplicated the default values
# and would prevent detection of an accidental change from default values.
let(:params) do
{
'password' => 'Niner2',
Expand Down

0 comments on commit 0ab8798

Please sign in to comment.