Skip to content

Commit

Permalink
initial revision, add basic npm tests. tests run locally; haven't run…
Browse files Browse the repository at this point in the history
… on gitlab yet (#7401)

update chef version for running locally on windows

Adds new kitchen tests to gitlab

shorten name to meet azure length requirements

Split npm into two separate tests.
The basic install validation, that can be run on only a few platforms.
The test that the kernel driver loads and runs onto its own tests, which
will be run on all supported kernels

Make the npm test actually load and check system probe.

fix compile error on missing test

Add reinstall cookbook (for reinstall testing with NPM flag)
Refactor copy/pasted code for checking agent version down to single
implementation.
Add 3 new test rspecs
- upgrade-to-npm
 On upgrade from prior (non-NPM enabled version), when proper flag is
 supplied, ensure NPM is actually enabled
- upgrade-no-npm
 On upgrade from prior (non-npm enabled version), when flag is not
 supplied, ensure NPM is not installed
- win-reinstall-option
 Allow reinstall with flag to enable NPM, if NPM was intended (but
 overlooked) on original install

fix improper quoting on require statements

Fix errors in refactoring upgrade/version checking

fix copy/paste
  • Loading branch information
derekwbrown authored Feb 17, 2021
1 parent d773733 commit 0c5dde9
Show file tree
Hide file tree
Showing 37 changed files with 811 additions and 46 deletions.
52 changes: 52 additions & 0 deletions .gitlab/kitchen_testing/windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,32 @@
script:
- bash -l tasks/run-test-kitchen.sh windows-install-test $AGENT_MAJOR_VERSION

.kitchen_test_windows_npm_driver:
before_script: # test all of the kernels to make sure the driver loads and runs properly
- if [ $AGENT_MAJOR_VERSION == "7" ]; then export WINDOWS_TESTING_S3_BUCKET=$WINDOWS_TESTING_S3_BUCKET_A7; else export WINDOWS_TESTING_S3_BUCKET=$WINDOWS_TESTING_S3_BUCKET_A6; fi
- rsync -azr --delete ./ $SRC_PATH
- export TEST_PLATFORMS="win2016,urn,MicrosoftWindowsServer:WindowsServer:2016-Datacenter-Server-Core:2016.127.20190416"
- export TEST_PLATFORMS="$TEST_PLATFORMS|win2019,urn,MicrosoftWindowsServer:WindowsServer:2019-Datacenter-Core:2019.0.20190410"
- export TEST_PLATFORMS="$TEST_PLATFORMS|win1903,urn,MicrosoftWindowsServer:WindowsServer:Datacenter-Core-1903-with-Containers-smalldisk:18362.1256.2012032308"
- export TEST_PLATFORMS="$TEST_PLATFORMS|win1909,urn,MicrosoftWindowsServer:WindowsServer:datacenter-core-1909-with-containers-smalldisk:18363.1316.2101130054"
- export TEST_PLATFORMS="$TEST_PLATFORMS|win2004,urn,MicrosoftWindowsServer:WindowsServer:datacenter-core-2004-with-containers-smalldisk:19041.746.2101092327"
- export TEST_PLATFORMS="$TEST_PLATFORMS|win20h2,urn,MicrosoftWindowsServer:WindowsServer:datacenter-core-20h2-with-containers-smalldisk:19042.746.2101092352"
- cd $DD_AGENT_TESTING_DIR
- bash -l tasks/kitchen_setup.sh
script:
- bash -l tasks/run-test-kitchen.sh windows-npm-driver-test $AGENT_MAJOR_VERSION

.kitchen_test_windows_npm_installer:
before_script: # Use only 2016 and 2019 for testing that we upgrade properly and don't install the driver when not specified
- if [ $AGENT_MAJOR_VERSION == "7" ]; then export WINDOWS_TESTING_S3_BUCKET=$WINDOWS_TESTING_S3_BUCKET_A7; else export WINDOWS_TESTING_S3_BUCKET=$WINDOWS_TESTING_S3_BUCKET_A6; fi
- rsync -azr --delete ./ $SRC_PATH
- export TEST_PLATFORMS="win2016,urn,MicrosoftWindowsServer:WindowsServer:2016-Datacenter-Server-Core:2016.127.20190416"
- export TEST_PLATFORMS="$TEST_PLATFORMS|win2019,urn,MicrosoftWindowsServer:WindowsServer:2019-Datacenter-Core:2019.0.20190410"
- cd $DD_AGENT_TESTING_DIR
- bash -l tasks/kitchen_setup.sh
script:
- bash -l tasks/run-test-kitchen.sh windows-npm-install-test $AGENT_MAJOR_VERSION

# Kitchen: Test types (test suite * agent flavor + azure location)
# -------------------------------

Expand All @@ -48,6 +74,18 @@
- .kitchen_datadog_agent_flavor
- .kitchen_azure_location_north_central_us

.kitchen_test_windows_installer_driver:
extends:
- .kitchen_test_windows_npm_driver
- .kitchen_datadog_agent_flavor
- .kitchen_azure_location_north_central_us

.kitchen_test_windows_installer_npm:
extends:
- .kitchen_test_windows_npm_installer
- .kitchen_datadog_agent_flavor
- .kitchen_azure_location_north_central_us

# Kitchen: scenarios (os * agent)
# -------------------------------

Expand All @@ -66,6 +104,20 @@
# Kitchen: final test matrix (test types * scenarios)
# ----------------------------------------------

kitchen_windows_installer_npm_install_scenarios-a7:
extends:
- .kitchen_scenario_windows_a7
- .kitchen_test_windows_installer_npm
allow_failure: true
retry: 0

kitchen_windows_installer_npm_driver-a7:
extends:
- .kitchen_scenario_windows_a7
- .kitchen_test_windows_installer_driver
allow_failure: true
retry: 0

kitchen_windows_installer_agent-a6:
extends:
- .kitchen_scenario_windows_a6
Expand Down
1 change: 1 addition & 0 deletions test/kitchen/Berksfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ cookbook 'docker', '< 7.3.0'
cookbook 'selinux'

cookbook 'dd-agent-install', path: './site-cookbooks/dd-agent-install'
cookbook 'dd-agent-reinstall', path: './site-cookbooks/dd-agent-reinstall'
cookbook 'dd-agent-upgrade', path: './site-cookbooks/dd-agent-upgrade'
cookbook 'dd-agent-install-script', path: './site-cookbooks/dd-agent-install-script'
cookbook 'dd-agent-step-by-step', path: './site-cookbooks/dd-agent-step-by-step'
Expand Down
2 changes: 1 addition & 1 deletion test/kitchen/kitchen-azure-common.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ provisioner:
name: chef_solo
product_name: chef
<% if ENV['KITCHEN_DRIVER'] && ENV['KITCHEN_DRIVER'] == "hyperv" %>
product_version: 13.6.4
product_version: 13.9.1
<% else %>
product_version: 14.12.9
<% end %>
Expand Down
179 changes: 179 additions & 0 deletions test/kitchen/kitchen-azure-windows-npm-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,179 @@
suites:

# installs the current shipping latest build
# then upgrades, and ensures that NPM is installed and running
- name: dd-agent-upgrade-to-npm
run_list:
- "recipe[dd-agent-install]"
- "recipe[dd-agent-upgrade]"
attributes:
datadog:
agent_major_version: 7
api_key: <%= api_key %>
<% if ENV['AGENT_FLAVOR'] == 'datadog-iot-agent' %>
agent_flavor: 'datadog-iot-agent'
<% end %>
dd-agent-install:
agent_major_version: 7
dd-agent-upgrade:
add_new_repo: true
<% if ENV['AGENT_FLAVOR'] == 'datadog-iot-agent' %>
package_name: 'datadog-iot-agent'
<% end %>
<% dd_agent_config.each do |key, value| %>
<%= key %>: <%= value %>
<% end %>
<% if ENV['AGENT_VERSION'] %>
windows_version: "<%= ENV['AGENT_VERSION'] %>"
<% end %>
<% if ENV['WINDOWS_AGENT_FILE'] %>
windows_agent_filename: "<%= ENV['WINDOWS_AGENT_FILE'] %>"
<% end %>
agent_install_options: >
ADDLOCAL=ALL
dd-agent-import-conf:
api_key: <%= api_key %>
dd-agent-upgrade-rspec:
# Used by the rspec test to know the version to which the agent should be upgraded
agent_expected_version: &agent_expected_version <%= ENV['DD_AGENT_EXPECTED_VERSION'] || "5.99.0" %>
dd-agent-rspec:
skip_windows_signing_test: &skip_windows_signing_test <%= ENV['SKIP_SIGNATURE_TEST'] || false %>

# installs the current shipping latest build
# then upgrades, and ensures that NPM not installed (due to lack of installation option)
- name: dd-agent-upgrade-no-npm
run_list:
- "recipe[dd-agent-install]"
- "recipe[dd-agent-upgrade]"
attributes:
datadog:
agent_major_version: 7
api_key: <%= api_key %>
<% if ENV['AGENT_FLAVOR'] == 'datadog-iot-agent' %>
agent_flavor: 'datadog-iot-agent'
<% end %>
dd-agent-install:
agent_major_version: 7
dd-agent-upgrade:
add_new_repo: true
<% if ENV['AGENT_FLAVOR'] == 'datadog-iot-agent' %>
package_name: 'datadog-iot-agent'
<% end %>
<% dd_agent_config.each do |key, value| %>
<%= key %>: <%= value %>
<% end %>
<% if ENV['AGENT_VERSION'] %>
windows_version: "<%= ENV['AGENT_VERSION'] %>"
<% end %>
<% if ENV['WINDOWS_AGENT_FILE'] %>
windows_agent_filename: "<%= ENV['WINDOWS_AGENT_FILE'] %>"
<% end %>
dd-agent-import-conf:
api_key: <%= api_key %>
dd-agent-upgrade-rspec:
# Used by the rspec test to know the version to which the agent should be upgraded
agent_expected_version: &agent_expected_version <%= ENV['DD_AGENT_EXPECTED_VERSION'] || "5.99.0" %>
dd-agent-rspec:
skip_windows_signing_test: &skip_windows_signing_test <%= ENV['SKIP_SIGNATURE_TEST'] || false %>

- name: dd-agent-win-npm-no-npm-option
run_list:
- "recipe[dd-agent-install]"
attributes:
datadog:
agent_major_version: 7
api_key: <%= api_key %>
<% if ENV['AGENT_FLAVOR'] == 'datadog-iot-agent' %>
agent_flavor: 'datadog-iot-agent'
<% end %>
dd-agent-install:
agent6: true
agent_major_version: 7
windows_agent_url: <%= windows_agent_url %>
<% if ENV['AGENT_VERSION'] %>
windows_version: "<%= ENV['AGENT_VERSION'] %>"
<% end %>
windows_agent_url: <%= windows_agent_url %>
<% if ENV['WINDOWS_AGENT_FILE'] %>
windows_agent_filename: "<%= ENV['WINDOWS_AGENT_FILE'] %>"
<% end %>
dd-agent-rspec:
agent_flavor: <%= ENV['AGENT_FLAVOR'] || "datadog-agent" %>
skip_windows_signing_test: &skip_windows_signing_test <%= ENV['SKIP_SIGNATURE_TEST'] || false %>

- name: dd-agent-win-reinstall-option
run_list:
- "recipe[dd-agent-install]"
- "recipe[dd-agent-reinstall]"
attributes:
datadog:
agent_major_version: 7
api_key: <%= api_key %>
<% if ENV['AGENT_FLAVOR'] == 'datadog-iot-agent' %>
agent_flavor: 'datadog-iot-agent'
<% end %>
dd-agent-install:
agent6: true
agent_major_version: 7
windows_agent_url: <%= windows_agent_url %>
<% if ENV['AGENT_VERSION'] %>
windows_version: "<%= ENV['AGENT_VERSION'] %>"
<% end %>
windows_agent_url: <%= windows_agent_url %>
<% if ENV['WINDOWS_AGENT_FILE'] %>
windows_agent_filename: "<%= ENV['WINDOWS_AGENT_FILE'] %>"
<% end %>
dd-agent-reinstall:
agent6: true
agent_major_version: 7
windows_agent_url: <%= windows_agent_url %>
<% if ENV['AGENT_VERSION'] %>
windows_version: "<%= ENV['AGENT_VERSION'] %>"
<% end %>
windows_agent_url: <%= windows_agent_url %>
<% if ENV['WINDOWS_AGENT_FILE'] %>
windows_agent_filename: "<%= ENV['WINDOWS_AGENT_FILE'] %>"
<% end %>
agent_install_options: >
ADDLOCAL=ALL
dd-agent-rspec:
agent_flavor: <%= ENV['AGENT_FLAVOR'] || "datadog-agent" %>
skip_windows_signing_test: &skip_windows_signing_test <%= ENV['SKIP_SIGNATURE_TEST'] || false %>


- name: dd-agent-win-npm-beta-upgrade
run_list:
- "recipe[dd-agent-install]"
- "recipe[dd-agent-upgrade]"
attributes:
datadog:
agent_major_version: 7
api_key: <%= api_key %>
<% if ENV['AGENT_FLAVOR'] == 'datadog-iot-agent' %>
agent_flavor: 'datadog-iot-agent'
<% end %>
dd-agent-install:
agent_major_version: 7
windows_agent_url: https://ddagent-windows-unstable.s3.amazonaws.com/
windows_agent_filename: datadog-agent-7.23.2-beta1-1-x86_64
dd-agent-upgrade:
add_new_repo: true
<% if ENV['AGENT_FLAVOR'] == 'datadog-iot-agent' %>
package_name: 'datadog-iot-agent'
<% end %>
<% dd_agent_config.each do |key, value| %>
<%= key %>: <%= value %>
<% end %>
<% if ENV['AGENT_VERSION'] %>
windows_version: "<%= ENV['AGENT_VERSION'] %>"
<% end %>
<% if ENV['WINDOWS_AGENT_FILE'] %>
windows_agent_filename: "<%= ENV['WINDOWS_AGENT_FILE'] %>"
<% end %>
dd-agent-import-conf:
api_key: <%= api_key %>
dd-agent-upgrade-rspec:
# Used by the rspec test to know the version to which the agent should be upgraded
agent_expected_version: &agent_expected_version <%= ENV['DD_AGENT_EXPECTED_VERSION'] || "5.99.0" %>
dd-agent-rspec:
skip_windows_signing_test: &skip_windows_signing_test <%= ENV['SKIP_SIGNATURE_TEST'] || false %>
31 changes: 31 additions & 0 deletions test/kitchen/kitchen-azure-windows-npmdriver.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
suites:

- name: dd-agent-win-with-npm-option
run_list:
- "recipe[dd-agent-install]"
attributes:
datadog:
agent_major_version: 7
api_key: <%= api_key %>
<% if ENV['AGENT_FLAVOR'] == 'datadog-iot-agent' %>
agent_flavor: 'datadog-iot-agent'
<% end %>
enable_process_agent: true
dd-agent-install:
agent_major_version: 7
agent6: true
windows_agent_url: <%= windows_agent_url %>
<% if ENV['AGENT_VERSION'] %>
windows_version: "<%= ENV['AGENT_VERSION'] %>"
<% end %>
windows_agent_url: <%= windows_agent_url %>
<% if ENV['WINDOWS_AGENT_FILE'] %>
windows_agent_filename: "<%= ENV['WINDOWS_AGENT_FILE'] %>"
<% end %>
agent_install_options: >
NPM=true
dd-agent-rspec:
agent_flavor: <%= ENV['AGENT_FLAVOR'] || "datadog-agent" %>
skip_windows_signing_test: &skip_windows_signing_test <%= ENV['SKIP_SIGNATURE_TEST'] || false %>


15 changes: 15 additions & 0 deletions test/kitchen/site-cookbooks/dd-agent-reinstall/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
.vagrant
Berksfile.lock
*~
*#
.#*
\#*#
.*.sw[a-z]
*.un~
/cookbooks

# Bundler
Gemfile.lock
bin/*
.bundle/*

3 changes: 3 additions & 0 deletions test/kitchen/site-cookbooks/dd-agent-reinstall/Berksfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
site :opscode

metadata
4 changes: 4 additions & 0 deletions test/kitchen/site-cookbooks/dd-agent-reinstall/Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
source 'https://rubygems.org'

gem 'bundler', '1.17.3'
gem 'berkshelf'
3 changes: 3 additions & 0 deletions test/kitchen/site-cookbooks/dd-agent-reinstall/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# dd-agent-reinstall cookbook

Reinstalls the same version, using different installer flags
Loading

0 comments on commit 0c5dde9

Please sign in to comment.