add PR testing #1

Merged
oliverpool merged 23 commits from testing into main 2023-08-20 06:44:28 +00:00
Contributor

Testing the action does:

  • compile the test (might be slow because of dependency fetching), without running them
  • run the pre-compiled test with a special env variable to tell it to keep listening forever (in case some previous test fails, no listening will happen)
  • the address where it is listening is written as output
  • this address is used to test the action as ovh-endpoint
  • if any parameter is wrong, the server will reply with a 400, which will make the command fail (e.g. https://code.forgejo.org/actions/ovh-dns-update/actions/runs/7/jobs/0 with v=42 instead of v=1.42)
Testing the action does: - compile the test (might be slow because of dependency fetching), without running them - run the pre-compiled test with a special env variable to tell it to keep listening forever (in case some previous test fails, no listening will happen) - the address where it is listening is written as output - this address is used to test the action as `ovh-endpoint` - if any parameter is wrong, the server will reply with a 400, which will make the command fail (e.g. https://code.forgejo.org/actions/ovh-dns-update/actions/runs/7/jobs/0 with `v=42` instead of `v=1.42`)
oliverpool added 1 commit 2023-08-18 13:50:18 +00:00
Some checks failed
pr / test (pull_request) Failing after 17s
3ec0204437
add pr workflow
oliverpool added 1 commit 2023-08-18 14:07:58 +00:00
Some checks failed
pr / test (pull_request) Failing after 16s
cb09b4af4d
run test
oliverpool added 1 commit 2023-08-18 14:10:01 +00:00
Some checks failed
pr / test (pull_request) Failing after 18s
071f5084c6
fix
oliverpool added 1 commit 2023-08-18 14:11:42 +00:00
Some checks failed
pr / test (pull_request) Failing after 19s
5a29956273
set inputs
oliverpool added 1 commit 2023-08-18 14:13:49 +00:00
Some checks failed
pr / test (pull_request) Failing after 19s
4486ccbb21
debug
oliverpool added 1 commit 2023-08-18 14:15:12 +00:00
Some checks failed
pr / test (pull_request) Failing after 18s
c1afe4c4a7
adjust github output
oliverpool added 1 commit 2023-08-18 14:20:08 +00:00
Some checks failed
pr / test (pull_request) Failing after 18s
95e1d4e7d1
nicer test
oliverpool added 1 commit 2023-08-18 14:21:31 +00:00
All checks were successful
pr / test (pull_request) Successful in 20s
4c59b6079b
fix test
oliverpool added 1 commit 2023-08-18 14:22:52 +00:00
All checks were successful
pr / test (pull_request) Successful in 16s
e402826f1a
add comments
oliverpool changed title from WIP: add pr workflow to add PR testing 2023-08-18 14:23:13 +00:00
oliverpool requested review from earl-warren 2023-08-18 14:28:42 +00:00
oliverpool added 1 commit 2023-08-18 14:28:59 +00:00
All checks were successful
pr / test (pull_request) Successful in 17s
105a5e79af
unused env
earl-warren reviewed 2023-08-18 15:20:29 +00:00
@ -43,0 +69,4 @@
msg := fmt.Sprintf("unexpected body: %s", string(buf))
http.Error(w, msg, http.StatusBadRequest)
t.Error(msg)
}
Owner

Almost perfect except the action above will succeed if nothing happens at all. To verify this code path is covered something like writting buf to /tmp/payload could be used here. And in a step that follows the use: ./ you could loop waiting for /tmp/payload to exist and verify it contains the v=1.42 string. That would be proof the action was successful.

Or... maybe I'm missing some other proof of success?

Almost perfect except the action above will succeed if nothing happens at all. To verify this code path is covered something like writting buf to `/tmp/payload` could be used here. And in a step that follows the **use: ./** you could loop waiting for `/tmp/payload` to exist and verify it contains the `v=1.42` string. That would be proof the action was successful. Or... maybe I'm missing some other proof of success?
Author
Contributor

Thanks for the review!

You are right, that if the action.yml did nothing at all, the test would still pass.

After a lot of trial and error, I have refactored it to check the updated record at a later stage.
I first tried to set an output from the testing server, but it does on appear if written after the stage (the testing server is running in the background). So I write a normal file dns.txt with the record,

Thanks for the review! You are right, that if the `action.yml` did nothing at all, the test would still pass. After a lot of trial and error, I have refactored it to check the updated record at a later stage. I first tried to set an `output` from the testing server, but it does on appear if written after the stage (the testing server is running in the background). So I write a normal file `dns.txt` with the record,
Owner

Excellent.

Excellent.
oliverpool added 1 commit 2023-08-19 18:13:41 +00:00
Some checks failed
pr / test (pull_request) Failing after 16s
1e88a41e80
check DNS_TXT
oliverpool added 1 commit 2023-08-19 18:20:33 +00:00
Some checks failed
pr / test (pull_request) Failing after 15s
35397949f8
better check
oliverpool added 1 commit 2023-08-19 18:21:50 +00:00
Some checks failed
pr / test (pull_request) Failing after 14s
fcd44737dc
debug: ls
oliverpool added 1 commit 2023-08-19 18:23:23 +00:00
Some checks failed
pr / test (pull_request) Failing after 14s
ddda991f33
return error
oliverpool added 1 commit 2023-08-19 18:25:10 +00:00
Some checks failed
pr / test (pull_request) Failing after 14s
d9a2a6c1f0
fix perm
oliverpool added 1 commit 2023-08-19 18:26:16 +00:00
Some checks failed
pr / test (pull_request) Failing after 14s
4c895cfb21
better perm
oliverpool added 1 commit 2023-08-19 18:27:47 +00:00
Some checks failed
pr / test (pull_request) Failing after 15s
4993f9cae9
perm decimal
oliverpool added 1 commit 2023-08-19 18:29:20 +00:00
Some checks failed
pr / test (pull_request) Failing after 15s
fceb957eac
perm octal
oliverpool added 1 commit 2023-08-19 18:30:47 +00:00
All checks were successful
pr / test (pull_request) Successful in 16s
c0415a97da
cleanup
oliverpool added 2 commits 2023-08-19 18:36:20 +00:00
Some checks failed
pr / test (pull_request) Failing after 12s
1957e53875
use inotifywait
oliverpool added 1 commit 2023-08-19 18:40:58 +00:00
Some checks failed
pr / test (pull_request) Failing after 13s
cf0961cda8
use tail
oliverpool added 1 commit 2023-08-19 18:41:49 +00:00
All checks were successful
pr / test (pull_request) Successful in 16s
d5b70bb852
prevent fail on tail
oliverpool removed review request for earl-warren 2023-08-19 18:45:23 +00:00
oliverpool requested review from earl-warren 2023-08-19 18:45:28 +00:00
dachary approved these changes 2023-08-19 19:13:00 +00:00
earl-warren approved these changes 2023-08-20 06:10:33 +00:00
oliverpool merged commit 86ff171ddd into main 2023-08-20 06:44:28 +00:00
oliverpool deleted branch testing 2023-08-20 06:44:29 +00:00
oliverpool referenced this pull request from a commit 2023-08-20 06:44:29 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
3 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: actions/ovh-dns-update#1
No description provided.