Skip to content

Commit 7f17c09

Browse files
committed
fix merge conflicts
2 parents 4d46499 + 240e58e commit 7f17c09

File tree

29 files changed

+2119
-2507
lines changed

29 files changed

+2119
-2507
lines changed

dsc/Cargo.lock

Lines changed: 421 additions & 407 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dsc/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "dsc"
3-
version = "3.2.0-preview.1"
3+
version = "3.2.0-preview.2"
44
edition = "2021"
55

66
[profile.release]
@@ -18,7 +18,7 @@ clap_complete = { version = "4.5" }
1818
crossterm = { version = "0.29" }
1919
ctrlc = { version = "3.4" }
2020
dsc_lib = { path = "../dsc_lib" }
21-
indicatif = { version = "0.17" }
21+
indicatif = { version = "0.18" }
2222
jsonschema = { version = "0.30", default-features = false }
2323
path-absolutize = { version = "3.1" }
2424
rust-i18n = { version = "3.1" }

dsc/tests/dsc_metadata.tests.ps1

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
# Copyright (c) Microsoft Corporation.
2+
# Licensed under the MIT License.
3+
4+
Describe 'metadata tests' {
5+
It 'resource can provide metadata for <operation>' -TestCases @(
6+
@{ operation = 'get' }
7+
@{ operation = 'set' }
8+
@{ operation = 'test' }
9+
) {
10+
param($operation)
11+
12+
$configYaml = @'
13+
$schema: https://aka.ms/dsc/schemas/v3/bundled/config/document.json
14+
resources:
15+
- name: test
16+
type: Test/Metadata
17+
properties:
18+
_metadata:
19+
hello: world
20+
myNumber: 42
21+
'@
22+
23+
$out = dsc config $operation -i $configYaml 2>$TestDrive/error.log | ConvertFrom-Json
24+
$LASTEXITCODE | Should -Be 0
25+
$out.results.count | Should -Be 1
26+
$out.results[0].metadata.hello | Should -BeExactly 'world'
27+
$out.results[0].metadata.myNumber | Should -Be 42
28+
}
29+
30+
It 'resource can provide metadata for export' {
31+
$configYaml = @'
32+
$schema: https://aka.ms/dsc/schemas/v3/bundled/config/document.json
33+
resources:
34+
- name: test
35+
type: Test/Metadata
36+
properties:
37+
_metadata:
38+
hello: There
39+
myNumber: 16
40+
'@
41+
$out = dsc config export -i $configYaml 2>$TestDrive/error.log | ConvertFrom-Json
42+
$LASTEXITCODE | Should -Be 0
43+
$out.resources.count | Should -Be 3
44+
$out.resources[0].metadata.hello | Should -BeExactly 'There'
45+
$out.resources[0].metadata.myNumber | Should -Be 16
46+
$out.resources[0].name | Should -BeExactly 'Metadata example 1'
47+
$out.resources[1].metadata.hello | Should -BeExactly 'There'
48+
$out.resources[1].metadata.myNumber | Should -Be 16
49+
$out.resources[1].name | Should -BeExactly 'Metadata example 2'
50+
$out.resources[2].metadata.hello | Should -BeExactly 'There'
51+
$out.resources[2].metadata.myNumber | Should -Be 16
52+
$out.resources[2].name | Should -BeExactly 'Metadata example 3'
53+
}
54+
55+
It 'resource returning Microsoft.DSC metadata is ignored' {
56+
$configYaml = @'
57+
$schema: https://aka.ms/dsc/schemas/v3/bundled/config/document.json
58+
resources:
59+
- name: test
60+
type: Test/Metadata
61+
properties:
62+
_metadata:
63+
Microsoft.DSC:
64+
hello: world
65+
validOne: true
66+
'@
67+
$out = dsc config get -i $configYaml 2>$TestDrive/error.log | ConvertFrom-Json
68+
$LASTEXITCODE | Should -Be 0
69+
$out.results.count | Should -Be 1
70+
$out.results[0].metadata.validOne | Should -BeTrue
71+
$out.results[0].metadata.Microsoft.DSC | Should -BeNullOrEmpty
72+
(Get-Content $TestDrive/error.log) | Should -BeLike "*WARN*Resource returned '_metadata' property 'Microsoft.DSC' which is ignored*"
73+
}
74+
}

0 commit comments

Comments
 (0)