pdqtest 1.9.9beta6 → 1.9.9beta7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e9833010ae1e09cfb08af4e3ce5471a07df1fcc7fd8f674b44399f6f5dc021fc
4
- data.tar.gz: c5310840d59b593d0bae1d63a2cc61b84f47ccc8cfa6f72afedb5e9f10335e91
3
+ metadata.gz: dd42c9920bb14bf63ba6dc6d021cb5bc2cb336aca20b76dcb41f8c19a317e545
4
+ data.tar.gz: 295dec7313f15b1e59348ea7e1106b8a03523ee5efe5bacb61b7a1df0e8e48bd
5
5
  SHA512:
6
- metadata.gz: d2472553063f8d3b17612b7b692a6af350bb7f83090296042778cce7e0e40e0b87a680af4abb98cda3916276643e8bc409e42dc9b46edcd8397a69de538ef07c
7
- data.tar.gz: bacbb3ffde09c8df33c5d5861a3b51735d830bef228b7d42ff9d00533bbd08bf30b7590b2e0092429c785e881355296a8bd648b9296db715aa3efe359712e646
6
+ metadata.gz: a886738ec27f9f20017f4a42d224b7a2b1edc62e3e55f5e8e472850abe61219e57766793c130d872389e1250b2000cf7fc5f703e0ca99569250ab71efabb8516
7
+ data.tar.gz: 62b42b4dc521d8f2d36937ef910bceb3fe193d6ddb866bbf11fe29ffc5f0c5d090123f33344cc73a77c1f59299260152377394d96a24681c0e5f86787554b9db
data/doc/pdk.md CHANGED
@@ -44,7 +44,7 @@ VMs in order to extract maximum speed. It offers a different approach to
44
44
  Of course, this will only ever give you an approximation of a real-world system
45
45
  but in many cases this is all that's needed. The complexity of setting up a
46
46
  100% accurate test environment is a daunting task and one that may never provide
47
- ROI on the effort spent configuring and maintaining it.
47
+ ROI vs the effort spent configuring and maintaining it.
48
48
 
49
49
  If perfect accuracy is indeed required, then PDQTest is not what you are looking
50
50
  for and you should look towards solutions like Beaker or
@@ -61,7 +61,10 @@ New projects should be created using PDK: `pdk new module`.
61
61
  This will give you all the PDK versioned files you would ever need. When you run
62
62
  `pdqtest init` on a new project created with PDK, we only copy in our own
63
63
  integration files and do not not touch the PDK generated files at all (the ones
64
- marked 🛠 below),
64
+ marked 🛠 below).
65
+
66
+ After running `pdqtest init`, run `pdk update` to have PDK process the
67
+ `.sync.yml` we installed.
65
68
 
66
69
  ### Existing PDQTest projects
67
70
  To make upgrading to PDQTest 2.0 + PDK easy for our existing users, we automate
@@ -79,18 +82,37 @@ unless PDK starts writing new files that we are already using.
79
82
  * `template-url`
80
83
  * `template-ref`
81
84
  The values for these fields are obtained automatically from PDK itself and are
82
- consistent with the system installed PDK.
85
+ consistent with the system installed PDK (we generate a temporary project and
86
+ read files/values from it).
83
87
 
84
88
  **Gemfile.project**
85
89
 
86
- * Add a reference to the `pdqtest` gem
90
+ If you require PDK to know about a particular gem for your project, add it to
91
+ this file and then run:
92
+
93
+ *Linux*
94
+ ```shell
95
+ make Gemfile.local
96
+ ```
97
+
98
+ *Windows*
99
+ ```shell
100
+ .\make.ps1 Gemfile.local
101
+ ```
102
+
103
+ Depending on platform, this will symlink or copy `Gemfile.project` to
104
+ `Gemfile.local` respectively, then run `pdk bundle install` to update PDK's
105
+ knowledge of the new gem.
106
+
87
107
 
88
108
  **Miscellaneous skeletons**
89
109
 
90
110
  When `pdqtest init` is run, we install a small set of skeleton files in the root
91
- of your project. This is a one-off operation to get you started. After your
92
- module has been marked as PDK compatible, we no longer attempt to update these
93
- files and you must only manage them using PDK from then-on.
111
+ of your project. This is a one-off operation to get you started and is _only_
112
+ done if your project is not already marked PDK compatible.
113
+
114
+ After your module has been marked as PDK compatible, you must only manage these
115
+ files using PDK.
94
116
 
95
117
  Skeletons are generated on the fly using PDK itself, so they are always
96
118
  up-to-date according to the PDK you have installed on your system.
@@ -99,7 +121,7 @@ up-to-date according to the PDK you have installed on your system.
99
121
  If you have an existing Puppet project that does not use PDQTest or PDK (eg
100
122
  created by hand or with the old `puppet module generate` command), then the
101
123
  recommended way to enable PDQTest is to first enable PDK by running
102
- `pdk convert` and following the wizard.
124
+ `pdk convert`, then follow the wizard.
103
125
 
104
126
  You may then enable `PDQTest` by running `pdqtest init`.
105
127
 
@@ -134,7 +156,7 @@ These are the files installed, files marked 🛠 are generated by PDK:
134
156
 
135
157
  The remaining files are specific to PDQTest - notably:
136
158
  * `.travis.yml` - Complete test suite for Linux modules
137
- * `bitbucket-pipelines.yaml` - RSpec testing only
159
+ * `bitbucket-pipelines.yaml` - logical testing only (unit/RSpec)
138
160
  * `.puppet-lint.rc` - Make lint errors test failures, ignore double quotes, etc
139
161
  * `Makefile` - Essential launch script for Linux
140
162
  * `make.ps1` - Essential launch script for Windows
@@ -20,4 +20,5 @@
20
20
  * Create/copy files, directories, etc.
21
21
  * Install OS packages
22
22
  * Install python scripts to mock database servers using SQLite... 😉
23
- * Files added by PDQTest >= 2.0 have the magic marker: `*File originally created by PDQTest*`
23
+ * Files added by PDQTest >= 2.0 have the magic marker:
24
+ `*File originally created by PDQTest*`
@@ -1,2 +1,2 @@
1
- docker build -t declarativesystems/pdqtest-windows:$([datetime]::now.tostring("yyyy-MM-dd"))-0 .
1
+ docker build --no-cache -t declarativesystems/pdqtest-windows:$([datetime]::now.tostring("yyyy-MM-dd"))-0 .
2
2
 
@@ -10,7 +10,7 @@ module PDQTest
10
10
  IMAGES = {
11
11
  :DEFAULT => 'declarativesystems/pdqtest-centos:2018-09-15-0',
12
12
  :UBUNTU => 'declarativesystems/pdqtest-ubuntu:2018-09-15-0',
13
- :WINDOWS => 'declarativesystems/pdqtest-windows:2018-09-18-0',
13
+ :WINDOWS => 'declarativesystems/pdqtest-windows:2018-09-29-0',
14
14
  }
15
15
 
16
16
  # volume paths are different for windows containers
@@ -7,13 +7,20 @@ module PDQTest
7
7
  def self.run
8
8
  $logger.debug "inside Fastcheck::run - current dir: #{Dir.pwd}"
9
9
 
10
- $logger.debug "Running syntax..."
11
- status = system("bundle exec 'rake syntax'")
10
+ # On windows, `system()` always executes `cmd.exe` so we can use `&&` to
11
+ # join commands... even when we launched from powershell.exe (! unproved)
12
+ #
13
+ # also must, MUST, MUST!!! use double quotes not singles to feed `system`
14
+ # or it will be eaten
15
+ cmd = "cd .pdqtest && bundle exec \"cd .. && rake syntax\""
16
+ $logger.debug "Running syntax...: #{cmd}"
17
+ status = system(cmd)
12
18
  $logger.debug "...done; result: #{status}"
13
19
 
14
20
  if status
15
- $logger.debug "Running lint..."
16
- status = system("bundle exec 'puppet-lint manifests'")
21
+ cmd = "cd .pdqtest && bundle exec \"cd .. && puppet lint --relative manifests\""
22
+ $logger.debug "Running lint...: #{cmd}"
23
+ status = system(cmd)
17
24
  $logger.debug "...done; result: #{status}"
18
25
  end
19
26
 
@@ -27,6 +27,7 @@ module PDQTest
27
27
  "Gemfile",
28
28
  "Rakefile",
29
29
  ".gitignore",
30
+ ".gitattributes",
30
31
  ]
31
32
 
32
33
  # PDK adds custom metadata fields which we can ONLY get by creating a new
@@ -42,6 +43,15 @@ module PDQTest
42
43
  "paths" => [
43
44
  ".Puppetfile.pdqtest",
44
45
  ],
46
+ },
47
+ ".gitattributes" => {
48
+ "include" => [
49
+ "*.epp eol=lf",
50
+ "*.json eol=lf",
51
+ "*.yaml eol=lf",
52
+ "*.yml eol=lf",
53
+ "*.md eol=lf",
54
+ ]
45
55
  }
46
56
  }.freeze
47
57
 
@@ -170,6 +180,13 @@ module PDQTest
170
180
  # snag generated metadata now we are in the temporary module dir
171
181
  Dir.chdir TEMP_PDK_MODULE do
172
182
  @@pdk_metadata = PDQTest::Puppet.module_metadata
183
+
184
+ # Now we need to install .sync.yml and re-install otherwise not
185
+ # applied until `pdk update`
186
+ PDQTest::Pdk.amend_sync_yml(SYNC_YML_CONTENT)
187
+
188
+ # Next do a forced update to make PDK process sync.yml
189
+ PDQTest::Pdk.run("update --force")
173
190
  end
174
191
 
175
192
  PDK_FILES.each do |pdk_file|
@@ -2,16 +2,15 @@ require 'pdqtest/skeleton'
2
2
 
3
3
  module PDQTest
4
4
  module Upgrade
5
- GEMDIR = '.pdqtest'
5
+ GEMDIR = '.pdqtest'.freeze
6
6
  GEMFILE = File.join(GEMDIR,'Gemfile')
7
7
  GEM_REGEXP = /gem ('|")([-\w]+)('|").*$/
8
8
  GEM_ATTRIB_REGEXP = /^\s*:\w+/
9
9
 
10
+ GEM_SOURCE = "source ENV['GEM_SOURCE'] || 'https://rubygems.org'".freeze
11
+ PDQTEST_MAGIC_MARKER = "*File originally created by PDQTest*".freeze
12
+
10
13
  GEMS = {
11
- # 'gemsource' => {
12
- # 'line' => "source ENV['GEM_SOURCE'] || 'https://rubygems.org'",
13
- # 'added' => false,
14
- # },
15
14
  'pdqtest' => {
16
15
  'line' => "gem 'pdqtest', '#{PDQTest::VERSION}'",
17
16
  'added' => false,
@@ -21,18 +20,25 @@ module PDQTest
21
20
  'added' => false,
22
21
  },
23
22
  'puppet' => {
24
- 'line' => "gem 'puppet'",
23
+ 'line' => "gem 'puppet', '5.5.3'",
25
24
  'added' => false,
26
25
  },
27
26
  'puppet-lint' => {
28
- 'line' => "gem 'puppet-lint'",
27
+ 'line' => "gem 'puppet-lint', '2.3.6'",
29
28
  'added' => false,
30
29
  },
31
30
  'puppet-syntax' => {
32
- 'line' => "gem 'puppet-syntax'",
31
+ 'line' => "gem 'puppet-syntax', '2.4.1'",
32
+ 'added' => false,
33
+ },
34
+ 'puppetlabs_spec_helper' => {
35
+ 'line' => "gem 'puppetlabs_spec_helper', '2.11.0'",
36
+ 'added' => false,
37
+ },
38
+ 'rake' => {
39
+ 'line' => "gem 'rake', '12.3.1'",
33
40
  'added' => false,
34
41
  },
35
-
36
42
  }.freeze
37
43
 
38
44
 
@@ -48,6 +54,13 @@ module PDQTest
48
54
 
49
55
  if ! File.exists?(GEMFILE)
50
56
  FileUtils.touch(GEMFILE)
57
+
58
+ # We are creating Gemfile for the first time, so add a gemsource and
59
+ # a magic marker
60
+ File.open(GEMFILE, 'w') do |file|
61
+ file.puts("# #{PDQTEST_MAGIC_MARKER}")
62
+ file.puts(GEM_SOURCE)
63
+ end
51
64
  end
52
65
  File.open(GEMFILE, 'r') do |f|
53
66
  f.each_line { |line|
@@ -1,3 +1,3 @@
1
1
  module PDQTest
2
- VERSION = "1.9.9beta6"
2
+ VERSION = "1.9.9beta7"
3
3
  end
@@ -27,7 +27,7 @@ pdqtestbundle:
27
27
  cd .pdqtest && pwd && bundle install
28
28
 
29
29
  docs:
30
- cd .pdqtest && pwd && bundle exec "cd ..&& puppet strings"
30
+ cd .pdqtest && pwd && bundle exec "cd ..&& puppet strings generate --format markdown"
31
31
 
32
32
 
33
33
  Gemfile.local:
@@ -37,3 +37,7 @@ Gemfile.local:
37
37
 
38
38
  pdkbundle:
39
39
  pdk bundle install
40
+
41
+ clean:
42
+ rm -rf pkg
43
+ rm -rf spec/fixtures/modules
@@ -1,5 +1,8 @@
1
1
  # *File originally created by PDQTest*
2
- image: ruby:2.3.5
2
+ # To run locally:
3
+ # https://confluence.atlassian.com/bitbucket/debug-your-pipelines-locally-with-docker-838273569.html
4
+ ---
5
+ image: ruby:2.4.1
3
6
 
4
7
  pipelines:
5
8
  default:
@@ -9,7 +12,12 @@ pipelines:
9
12
  script:
10
13
  - ruby --version
11
14
  - bundler --version
12
- - bundle install
15
+ - wget https://apt.puppetlabs.com/puppet5-release-trusty.deb
16
+ - dpkg -i puppet5-release-trusty.deb
17
+ - apt-get update
18
+ - apt install -y pdk
19
+ - sh .ci_custom.sh
20
+ - make pdqtestbundle
13
21
  - make logical
14
22
 
15
23
  definitions:
@@ -10,10 +10,10 @@
10
10
  .PARAMETER target
11
11
  Test suite to run
12
12
  #>
13
- # *File originally created by PDQTest*
14
13
  param(
15
14
  $target = "all"
16
15
  )
16
+ # *File originally created by PDQTest*
17
17
 
18
18
  $gfl = "Gemfile.local"
19
19
  $gfp = "Gemfile.project"
@@ -41,25 +41,44 @@ function Install-GemfileLocal {
41
41
 
42
42
  switch ($target) {
43
43
  "all" {
44
- Install-GemfileLocal
45
- bundle exec pdqtest all
44
+ cd .pdqtest; bundle exec pdqtest all; cd ..
46
45
  }
47
46
  "fast" {
48
- Install-GemfileLocal
49
- bundle exec pdqtest fast
47
+ cd .pdqtest; bundle exec pdqtest fast; cd ..
48
+ }
49
+ "acceptance" {
50
+ cd .pdqtest; bundle exec pdqtest acceptance; cd ..
50
51
  }
51
52
  "shell" {
52
- Install-GemfileLocal
53
- bundle exec pdqtest --keep-container acceptance
53
+ cd .pdqtest; bundle exec pdqtest --keep-container acceptance; cd ..
54
54
  }
55
55
  "shellnopuppet" {
56
- Install-GemfileLocal
57
- bundle exec pdqtest shell
56
+ cd .pdqtest; bundle exec pdqtest shell; cd ..
57
+ }
58
+ "setup" {
59
+ cd .pdqtest; bundle exec pdqtest setup; cd ..
58
60
  }
59
61
  "logical" {
60
- Install-GemfileLocal
61
- bundle exec pdqtest syntax
62
- bundle exec pdqtest rspec
62
+ cd .pdqtest; bundle exec pdqtest logical; cd ..
63
+ cd .pdqtest ; bundle exec "cd ..; puppet strings"; cd ..
64
+ }
65
+ "docs" {
66
+ cd .pdqtest ; bundle exec "cd ..; puppet strings generate --format markdown"; cd ..
67
+ }
68
+ "Gemfile.local" {
69
+ echo "[(-_-)zzz] *copying* Gemfile.project to Gemfile.local and running pdk bundle..."
70
+ Install-GemfileLocal
71
+ .\make.ps1 pdkbundle
72
+ }
73
+ "pdqtestbundle" {
74
+ cd .pdqtest ; bundle install; cd ..
75
+ }
76
+ "pdkbundle" {
77
+ pdk bundle install
78
+ }
79
+ "clean" {
80
+ Remove-Item -ErrorAction SilentlyContinue -Confirm:$false -Recurse -force pkg
81
+ Remove-Item -ErrorAction SilentlyContinue -Confirm:$false -Recurse -force spec/fixtures/modules
63
82
  }
64
83
  default {
65
84
  Write-Error "No such target: $($target)"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pdqtest
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.9.9beta6
4
+ version: 1.9.9beta7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Geoff Williams
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-09-29 00:00:00.000000000 Z
11
+ date: 2018-09-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler