Skip to content

Commit

Permalink
FileConventions: add failing test
Browse files Browse the repository at this point in the history
For inconsistent versions in GitHubCI yml files.
  • Loading branch information
knocte authored and tehraninasab committed Jun 26, 2023
1 parent be1af69 commit 4f2d48c
Show file tree
Hide file tree
Showing 5 changed files with 87 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: CI

on: [push, pull_request]

jobs:
jobA:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v2
- name: Setup Pulumi CLI
uses: pulumi/[email protected]
with:
pulumi-version: 3.40.0
- name: Print "Hello World!"
run: echo "Hello World!"
jobB:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v2
- name: Setup Pulumi CLI
uses: pulumi/[email protected]
with:
pulumi-version: 3.40.0
- name: Print "Hello World!"
run: echo "Hello World!"
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: CI

on: [push, pull_request]

jobs:
jobA:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v2
- name: Setup Pulumi CLI
uses: pulumi/[email protected]
with:
pulumi-version: 3.40.0
- name: Print "Hello World!"
run: echo "Hello World!"
jobB:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v2
- name: Setup Pulumi CLI
uses: pulumi/[email protected]
with:
pulumi-version: 3.41.0
- name: Print "Hello World!"
run: echo "Hello World!"
31 changes: 31 additions & 0 deletions src/FileConventions.Test/FileConventions.Test.fs
Original file line number Diff line number Diff line change
Expand Up @@ -348,3 +348,34 @@ let WrapTextTest4() =
+ "characters."

Assert.That(WrapText text characterCount, Is.EqualTo expectedResult)
[<Test>]

let DetectInconsistentVersionsInGitHubCIWorkflow1() =
let fileInfo =
(FileInfo(
Path.Combine(
dummyFilesDirectory.FullName,
"DummyCIWithSamePulumiVersion.yml"
)
))

Assert.That(
DetectInconsistentVersionsInGitHubCIWorkflow fileInfo,
Is.EqualTo false
)


[<Test>]
let DetectInconsistentVersionsInGitHubCIWorkflow2() =
let fileInfo =
(FileInfo(
Path.Combine(
dummyFilesDirectory.FullName,
"DummyCIWithoutSamePulumiVersion.yml"
)
))

Assert.That(
DetectInconsistentVersionsInGitHubCIWorkflow fileInfo,
Is.EqualTo true
)
2 changes: 2 additions & 0 deletions src/FileConventions.Test/FileConventions.Test.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,7 @@
<None Include="DummyFiles\DummyCIWithoutLatestTag.yml" />
<None Include="DummyFiles\DummyWithMissingVersionsInNugetPackageReferences.fsx" />
<None Include="DummyFiles\DummyWithCRLFLineEndings" />
<None Include="DummyFiles\DummyCIWithoutSamePulumiVersion.yml" />
<None Include="DummyFiles\DummyCIWithSamePulumiVersion.yml" />
</ItemGroup>
</Project>
4 changes: 4 additions & 0 deletions src/FileConventions/Library.fs
Original file line number Diff line number Diff line change
Expand Up @@ -245,3 +245,7 @@ let WrapText (text: string) (maxCharsPerLine: int) : string =
$"{Environment.NewLine}{Environment.NewLine}",
wrappedParagraphs
)

let DetectInconsistentVersionsInGitHubCIWorkflow(fileInfo: FileInfo) =
assert (fileInfo.FullName.EndsWith ".yml")
false

0 comments on commit 4f2d48c

Please sign in to comment.