Skip to content

Commit

Permalink
Land #19256, Fix warnings in acceptance tests
Browse files Browse the repository at this point in the history
  • Loading branch information
dwelch-r7 authored Jun 13, 2024
2 parents f5aea8c + b48fbc6 commit d31d282
Show file tree
Hide file tree
Showing 11 changed files with 29 additions and 40 deletions.
4 changes: 1 addition & 3 deletions .github/workflows/ldap_acceptance.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,6 @@ on:
# - cron: '*/15 * * * *'

jobs:
env:
BUNDLE_WITHOUT: "coverage development pcap"

ldap:
runs-on: ${{ matrix.os }}
timeout-minutes: 40
Expand All @@ -59,6 +56,7 @@ jobs:

env:
RAILS_ENV: test
BUNDLE_WITHOUT: "coverage development pcap"

name: LDAP Acceptance - ${{ matrix.os }} - Ruby ${{ matrix.ruby }}
steps:
Expand Down
5 changes: 2 additions & 3 deletions .github/workflows/mssql_acceptance.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,6 @@ on:
# - cron: '*/15 * * * *'

jobs:
env:
BUNDLE_WITHOUT: "coverage development pcap"

mssql:
runs-on: ${{ matrix.os }}
timeout-minutes: 40
Expand Down Expand Up @@ -75,6 +72,8 @@ jobs:

env:
RAILS_ENV: test
BUNDLE_WITHOUT: "coverage development pcap"


name: ${{ matrix.docker_image }} - ${{ matrix.os }} - Ruby ${{ matrix.ruby }}
steps:
Expand Down
6 changes: 1 addition & 5 deletions .github/workflows/mysql_acceptance.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,6 @@ on:
# - cron: '*/15 * * * *'

jobs:
env:
BUNDLE_WITHOUT: "coverage development pcap"

mysql:
runs-on: ${{ matrix.os }}
timeout-minutes: 40
Expand All @@ -69,12 +66,11 @@ jobs:
- ubuntu-latest
target:
- { version: "mariadb:latest", health_cmd: "mariadb -uroot -ppassword -e 'SELECT version()'" }
- { version: "mariadb:5.5.42", health_cmd: "mysql -uroot -ppassword -e 'SELECT version()'" }
- { version: "mysql:latest", health_cmd: "mysql -uroot -ppassword -e 'SELECT version()'" }
- { version: "mysql:5.5.42", health_cmd: "mysql -uroot -ppassword -e 'SELECT version()'" }

env:
RAILS_ENV: test
BUNDLE_WITHOUT: "coverage development pcap"

name: ${{ matrix.target.version }} - ${{ matrix.os }} - Ruby ${{ matrix.ruby }}
steps:
Expand Down
4 changes: 1 addition & 3 deletions .github/workflows/postgres_acceptance.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,6 @@ on:
# - cron: '*/15 * * * *'

jobs:
env:
BUNDLE_WITHOUT: "coverage development pcap"

postgres:
runs-on: ${{ matrix.os }}
timeout-minutes: 40
Expand Down Expand Up @@ -75,6 +72,7 @@ jobs:

env:
RAILS_ENV: test
BUNDLE_WITHOUT: "coverage development pcap"

name: ${{ matrix.docker_image }} - ${{ matrix.os }} - Ruby ${{ matrix.ruby }}
steps:
Expand Down
4 changes: 1 addition & 3 deletions .github/workflows/smb_acceptance.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,6 @@ on:
# - cron: '*/15 * * * *'

jobs:
env:
BUNDLE_WITHOUT: "coverage development pcap"

smb:
runs-on: ${{ matrix.os }}
timeout-minutes: 40
Expand All @@ -61,6 +58,7 @@ jobs:
RAILS_ENV: test
SMB_USERNAME: acceptance_tests_user
SMB_PASSWORD: acceptance_tests_password
BUNDLE_WITHOUT: "coverage development pcap"

name: SMB Acceptance - ${{ matrix.os }} - Ruby ${{ matrix.ruby }}
steps:
Expand Down
8 changes: 4 additions & 4 deletions spec/acceptance/ldap_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

RHOST_REGEX = /\d+\.\d+\.\d+\.\d+:\d+/

TESTS = {
tests = {
ldap: {
target: {
session_module: 'auxiliary/scanner/ldap/ldap_login',
Expand Down Expand Up @@ -119,7 +119,7 @@
}
}

TEST_ENVIRONMENT = AllureRspec.configuration.environment_properties
allure_test_environment = AllureRspec.configuration.environment_properties

let_it_be(:current_platform) { Acceptance::Meterpreter.current_platform }

Expand Down Expand Up @@ -283,7 +283,7 @@ def with_test_harness(module_test)
raise console_reset_error if console_reset_error
end

TESTS.each do |runtime_name, test_config|
tests.each do |runtime_name, test_config|
runtime_name = "#{runtime_name}#{ENV.fetch('RUNTIME_VERSION', '')}"

describe "#{Acceptance::Meterpreter.current_platform}/#{runtime_name}", focus: test_config[:focus] do
Expand All @@ -299,7 +299,7 @@ def with_test_harness(module_test)
{}
end

let(:test_environment) { TEST_ENVIRONMENT }
let(:test_environment) { allure_test_environment }

let(:default_module_datastore) do
{
Expand Down
6 changes: 3 additions & 3 deletions spec/acceptance/meterpreter_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
}
)

TEST_ENVIRONMENT = AllureRspec.configuration.environment_properties
allure_test_environment = AllureRspec.configuration.environment_properties

let_it_be(:current_platform) { Acceptance::Meterpreter::current_platform }

Expand Down Expand Up @@ -92,7 +92,7 @@ def initialize(path)
}
end

let(:test_environment) { TEST_ENVIRONMENT }
let(:test_environment) { allure_test_environment }

let(:default_module_datastore) do
{
Expand Down Expand Up @@ -342,7 +342,7 @@ def get_file_attachment_contents(path)
Acceptance::Meterpreter.supported_platform?(payload_config) &&
Acceptance::Meterpreter.supported_platform?(module_test) &&
# Skip tests that are explicitly skipped, or won't pass in the current environment
!Acceptance::Meterpreter.skipped_module_test?(module_test, TEST_ENVIRONMENT)
!Acceptance::Meterpreter.skipped_module_test?(module_test, allure_test_environment)
),
# test metadata - will appear in allure report
module_test: module_test[:name]
Expand Down
8 changes: 4 additions & 4 deletions spec/acceptance/mssql_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
RSpec.describe 'MSSQL sessions and MSSQL modules' do
include_context 'wait_for_expect'

TESTS = {
tests = {
mssql: {
target: {
session_module: "auxiliary/scanner/mssql/mssql_login",
Expand Down Expand Up @@ -106,7 +106,7 @@
}
}

TEST_ENVIRONMENT = AllureRspec.configuration.environment_properties
allure_test_environment = AllureRspec.configuration.environment_properties

let_it_be(:current_platform) { Acceptance::Meterpreter::current_platform }

Expand Down Expand Up @@ -269,7 +269,7 @@ def with_test_harness(module_test)
raise console_reset_error if console_reset_error
end

TESTS.each do |runtime_name, test_config|
tests.each do |runtime_name, test_config|
runtime_name = "#{runtime_name}#{ENV.fetch('RUNTIME_VERSION', '')}"

describe "#{Acceptance::Meterpreter.current_platform}/#{runtime_name}", focus: test_config[:focus] do
Expand All @@ -287,7 +287,7 @@ def with_test_harness(module_test)
}
end

let(:test_environment) { TEST_ENVIRONMENT }
let(:test_environment) { allure_test_environment }

let(:default_module_datastore) do
{
Expand Down
8 changes: 4 additions & 4 deletions spec/acceptance/mysql_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

RHOST_REGEX = /\d+\.\d+\.\d+\.\d+:\d+/

TESTS = {
tests = {
mysql: {
target: {
session_module: "auxiliary/scanner/mysql/mysql_login",
Expand Down Expand Up @@ -84,7 +84,7 @@
}
}

TEST_ENVIRONMENT = AllureRspec.configuration.environment_properties
allure_test_environment = AllureRspec.configuration.environment_properties

let_it_be(:current_platform) { Acceptance::Meterpreter::current_platform }

Expand Down Expand Up @@ -247,7 +247,7 @@ def with_test_harness(module_test)
raise console_reset_error if console_reset_error
end

TESTS.each do |runtime_name, test_config|
tests.each do |runtime_name, test_config|
runtime_name = "#{runtime_name}#{ENV.fetch('RUNTIME_VERSION', '')}"

describe "#{Acceptance::Meterpreter.current_platform}/#{runtime_name}", focus: test_config[:focus] do
Expand All @@ -265,7 +265,7 @@ def with_test_harness(module_test)
}
end

let(:test_environment) { TEST_ENVIRONMENT }
let(:test_environment) { allure_test_environment }

let(:default_module_datastore) do
{
Expand Down
8 changes: 4 additions & 4 deletions spec/acceptance/postgres_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
RSpec.describe 'Postgres sessions and postgres modules' do
include_context 'wait_for_expect'

TESTS = {
tests = {
postgres: {
target: {
session_module: "auxiliary/scanner/postgres/postgres_login",
Expand Down Expand Up @@ -90,7 +90,7 @@
}
}

TEST_ENVIRONMENT = AllureRspec.configuration.environment_properties
allure_test_environment = AllureRspec.configuration.environment_properties

let_it_be(:current_platform) { Acceptance::Meterpreter::current_platform }

Expand Down Expand Up @@ -253,7 +253,7 @@ def with_test_harness(module_test)
raise console_reset_error if console_reset_error
end

TESTS.each do |runtime_name, test_config|
tests.each do |runtime_name, test_config|
runtime_name = "#{runtime_name}#{ENV.fetch('RUNTIME_VERSION', '')}"

describe "#{Acceptance::Meterpreter.current_platform}/#{runtime_name}", focus: test_config[:focus] do
Expand All @@ -271,7 +271,7 @@ def with_test_harness(module_test)
}
end

let(:test_environment) { TEST_ENVIRONMENT }
let(:test_environment) { allure_test_environment }

let(:default_module_datastore) do
{
Expand Down
8 changes: 4 additions & 4 deletions spec/acceptance/smb_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

RHOST_REGEX = /\d+\.\d+\.\d+\.\d+:\d+/

TESTS = {
tests = {
smb: {
target: {
session_module: "auxiliary/scanner/smb/smb_login",
Expand Down Expand Up @@ -92,7 +92,7 @@
}
}

TEST_ENVIRONMENT = AllureRspec.configuration.environment_properties
allure_test_environment = AllureRspec.configuration.environment_properties

let_it_be(:current_platform) { Acceptance::Meterpreter::current_platform }

Expand Down Expand Up @@ -259,7 +259,7 @@ def with_test_harness(module_test)
raise console_reset_error if console_reset_error
end

TESTS.each do |runtime_name, test_config|
tests.each do |runtime_name, test_config|
runtime_name = "#{runtime_name}#{ENV.fetch('RUNTIME_VERSION', '')}"

describe "#{Acceptance::Meterpreter.current_platform}/#{runtime_name}", focus: test_config[:focus] do
Expand All @@ -277,7 +277,7 @@ def with_test_harness(module_test)
}
end

let(:test_environment) { TEST_ENVIRONMENT }
let(:test_environment) { allure_test_environment }

let(:default_module_datastore) do
{
Expand Down

0 comments on commit d31d282

Please sign in to comment.