-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix systemd artifact install to account for artifact name
- Loading branch information
1 parent
9099c58
commit 577b9ef
Showing
3 changed files
with
83 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -468,6 +468,57 @@ fi | |
` | ||
assert.Equal(t, want, got) | ||
}) | ||
|
||
t.Run("test systemd artifact installed under a different name", func(t *testing.T) { | ||
spec := &dalec.Spec{ | ||
Name: "test-systemd-unit", | ||
Description: "Test systemd unit", | ||
Website: "https://www.github.com/Azure/dalec", | ||
Version: "0.0.1", | ||
Revision: "1", | ||
Vendor: "Microsoft", | ||
License: "Apache 2.0", | ||
Packager: "Microsoft <[email protected]>", | ||
Sources: map[string]dalec.Source{ | ||
"src": { | ||
Inline: &dalec.SourceInline{ | ||
Dir: &dalec.SourceInlineDir{ | ||
|
||
Files: map[string]*dalec.SourceInlineFile{ | ||
"simple.service": { | ||
Contents: ` | ||
Phony unit | ||
`}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
Artifacts: dalec.Artifacts{ | ||
Systemd: &dalec.SystemdConfiguration{ | ||
Units: map[string]dalec.SystemdUnitConfig{ | ||
"src/simple.service": { | ||
Enable: true, | ||
Name: "phony.service", | ||
}, | ||
}, | ||
}, | ||
}, | ||
} | ||
w := specWrapper{Spec: spec} | ||
|
||
assert.Equal(t, w.Install().String(), `%install | ||
mkdir -p %{buildroot}/%{_unitdir} | ||
cp -r src/simple.service %{buildroot}/%{_unitdir}/phony.service | ||
`) | ||
|
||
assert.Equal(t, w.Files().String(), `%files | ||
%{_unitdir}/phony.service | ||
`) | ||
}) | ||
|
||
} | ||
|
||
func TestTemplate_Requires(t *testing.T) { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters