| 771 | } |
| 772 | |
| 773 | func TestDeploymentValues_DurationFormatNanoseconds(t *testing.T) { |
| 774 | t.Parallel() |
| 775 | |
| 776 | set := (&codersdk.DeploymentValues{}).Options() |
| 777 | for _, s := range set { |
| 778 | if s.Value.Type() != "duration" { |
| 779 | continue |
| 780 | } |
| 781 | // Just make sure the annotation is set. |
| 782 | // If someone wants to not format a duration, they can |
| 783 | // explicitly set the annotation to false. |
| 784 | if s.Annotations.IsSet("format_duration") { |
| 785 | continue |
| 786 | } |
| 787 | t.Logf("Option %q is a duration but does not have the format_duration annotation.", s.Name) |
| 788 | t.Log("To fix this, add the following to the option declaration:") |
| 789 | t.Log(`Annotations: serpent.Annotations{}.Mark(annotationFormatDurationNS, "true"),`) |
| 790 | t.FailNow() |
| 791 | } |
| 792 | } |
| 793 | |
| 794 | //go:embed testdata/* |
| 795 | var testData embed.FS |