Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add testdata to fix unit tests #3

Merged
merged 1 commit into from
Jan 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions internal/contract/contract_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,13 @@ func TestNewContractFromFile(t *testing.T) {
g := o.NewWithT(t)

t.Run("Filename", func(_ *testing.T) {
c, err := NewContractFromFile("../../test/resources/.catalog.yaml")
c, err := NewContractFromFile("../../testdata/resources/.catalog.yaml")
g.Expect(err).To(o.BeNil())
g.Expect(c.Catalog.Resources).ToNot(o.BeNil())
})

t.Run("Directory", func(_ *testing.T) {
c, err := NewContractFromFile("../../test/resources")
c, err := NewContractFromFile("../../testdata/resources")
g.Expect(err).To(o.BeNil())
g.Expect(c.Catalog.Resources).ToNot(o.BeNil())
})
Expand Down
2 changes: 1 addition & 1 deletion internal/linter/linter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ func TestNewLinter(t *testing.T) {

cfg := config.NewConfig()

l, err := NewLinter(cfg, "../../test/resources/task.yaml")
l, err := NewLinter(cfg, "../../testdata/resources/task.yaml")
g.Expect(err).To(o.Succeed())
g.Expect(l).NotTo(o.BeNil())

Expand Down
2 changes: 1 addition & 1 deletion internal/render/markdown_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ func TestNewMarkdow(t *testing.T) {

cfg := config.NewConfig()

m, err := NewMarkdown(cfg, "../../test/resources/task.yaml")
m, err := NewMarkdown(cfg, "../../testdata/resources/task.yaml")
g.Expect(err).To(o.Succeed())
g.Expect(m).NotTo(o.BeNil())

Expand Down
17 changes: 17 additions & 0 deletions testdata/resources/.catalog.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
version: v1
catalog:
repository:
description: ""
attestation:
publickey: ""
resources:
tasks:
- name: task
version: 0.0.1
filename: ../../test/resources/task.yaml
checksum: f2d507741e983223beb94b5411264004e8d2cbbf0326a716c8313002e505e706
signature: ""
pipelines: []
probe:
tasks: []
pipelines: []
76 changes: 76 additions & 0 deletions testdata/resources/task.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
---
apiVersion: tekton.dev/v1beta1
kind: Task
metadata:
name: task
spec:
description: |
Task description.

workspaces:
- name: required-workspace
description: |
Workspace "required-workspace" description.
- name: optional-workspace
optional: true
description: |
Workspace "optional-workspace" description.

params:
- name: STRING_PARAM
type: string
description: |
String parameter description.
- name: STRING_PARAM_EMPTY
type: string
default: ""
description: |
String parameter description.
- name: STRING_PARAM_WITH_DEFAULT
type: string
default: default
description: |
String parameter description.
- name: ARRAY_PARAM
type: array
description: |
Array parameter description.
- name: ARRAY_PARAM_EMPTY
type: array
default: []
description: |
Array parameter description.
- name: ARRAY_PARAM_WITH_DEFAULT
type: array
default:
- entry
description: |
Array parameter description.
- name: OBJECT_PARAM
type: object
description: |
Object parameter description.
- name: OBJECT_PARAM_EMPTY
type: object
properties:
key:
type: string
default:
key: ""
description: |
Object parameter description.
- name: OBJECT_PARAM_WITH_DEFAULT
type: object
properties:
key:
type: string
default:
key: value
description: |
Object parameter description.


results:
- name: RESULT
description: |
Result description.