-
Notifications
You must be signed in to change notification settings - Fork 3
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
lint: Add testifylint to prevent unnecessary test code issues #1813
Conversation
25b8a7f
to
e5a0e34
Compare
assert.NoError(t, projectState.Set(branchState)) | ||
require.NoError(t, projectState.Set(branchState)) | ||
|
||
d := NewDiffer(projectState) | ||
results, err := d.Diff() | ||
assert.NoError(t, err) | ||
require.NoError(t, err) | ||
assert.Len(t, results.Results, 1) | ||
result := results.Results[0] | ||
assert.Equal(t, ResultOnlyInLocal, result.State) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sometimes it makes sense for the test to continue, so you get the overall picture and you don't have to run the test repeatedly.
I prefer to use assert and require only when there is no point in continuing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should you continue when err
is not nil? If yes then use if assert.NoError(t, err); err != nil { }
Otherwise it makes sense. I don't see anything else just a plain help to prevent unnecessary panics in test code. When you do not care about error, just omit it using _
e5a0e34
to
35df6fa
Compare
35df6fa
to
65d07ab
Compare
65d07ab
to
f305538
Compare
Templates API Kubernetes Diff [CI]Between Expand--- /tmp/artifacts/test-k8s-state.old.json.processed.kv 2024-11-22 12:48:36.419878086 +0000
+++ /tmp/artifacts/test-k8s-state.new.json.processed.kv 2024-11-22 12:48:36.651878699 +0000
@@ -194 +194 @@
-<Deployment/templates-api>.spec.template.spec.containers[0].image = "docker.io/keboola/templates-api:849e4bf-1732279046";
+<Deployment/templates-api>.spec.template.spec.containers[0].image = "docker.io/keboola/templates-api:f766f90-1732279361";
@@ -747,3 +747,3 @@
-<Pod/templates-api-<hash>>.spec.containers[0].image = "docker.io/keboola/templates-api:849e4bf-1732279046";
-<Pod/templates-api-<hash>>.spec.containers[0].image = "docker.io/keboola/templates-api:849e4bf-1732279046";
-<Pod/templates-api-<hash>>.spec.containers[0].image = "docker.io/keboola/templates-api:849e4bf-1732279046";
+<Pod/templates-api-<hash>>.spec.containers[0].image = "docker.io/keboola/templates-api:f766f90-1732279361";
+<Pod/templates-api-<hash>>.spec.containers[0].image = "docker.io/keboola/templates-api:f766f90-1732279361";
+<Pod/templates-api-<hash>>.spec.containers[0].image = "docker.io/keboola/templates-api:f766f90-1732279361";
@@ -1417 +1417 @@
-<ReplicaSet/templates-api-<hash>>.spec.template.spec.containers[0].image = "docker.io/keboola/templates-api:849e4bf-1732279046";
+<ReplicaSet/templates-api-<hash>>.spec.template.spec.containers[0].image = "docker.io/keboola/templates-api:f766f90-1732279361";
@@ -1488,0 +1489,12 @@
+<Secret/sh.helm.release.v1.templates-api-etcd.v2> = {};
+<Secret/sh.helm.release.v1.templates-api-etcd.v2>.apiVersion = "v1";
+<Secret/sh.helm.release.v1.templates-api-etcd.v2>.data = {};
+<Secret/sh.helm.release.v1.templates-api-etcd.v2>.kind = "Secret";
+<Secret/sh.helm.release.v1.templates-api-etcd.v2>.metadata = {};
+<Secret/sh.helm.release.v1.templates-api-etcd.v2>.metadata.labels = {};
+<Secret/sh.helm.release.v1.templates-api-etcd.v2>.metadata.labels.name = "templates-api-etcd";
+<Secret/sh.helm.release.v1.templates-api-etcd.v2>.metadata.labels.owner = "helm";
+<Secret/sh.helm.release.v1.templates-api-etcd.v2>.metadata.labels.version = "2";
+<Secret/sh.helm.release.v1.templates-api-etcd.v2>.metadata.name = "sh.helm.release.v1.templates-api-etcd.v2";
+<Secret/sh.helm.release.v1.templates-api-etcd.v2>.metadata.namespace = "templates-api";
+<Secret/sh.helm.release.v1.templates-api-etcd.v2>.type = "helm.sh/release.v1";
(see artifacts in the Github Action for more information) |
Jira: PSGO-682
Changes: