mirror of
https://github.com/wneessen/go-mail.git
synced 2024-11-24 22:50:49 +01:00
Compare commits
No commits in common. "e7e0fe03bbce4921675e6ccaccf176cb6a812ead" and "9682755e25bb2267768b8901c7574fe7134f86d7" have entirely different histories.
e7e0fe03bb
...
9682755e25
2 changed files with 8 additions and 16 deletions
5
.github/workflows/ci.yml
vendored
5
.github/workflows/ci.yml
vendored
|
@ -31,7 +31,6 @@ jobs:
|
|||
go: ['1.23']
|
||||
env:
|
||||
PERFORM_ONLINE_TEST: ${{ vars.PERFORM_ONLINE_TEST }}
|
||||
PERFORM_UNIX_OPEN_WRITE_TESTS: "true"
|
||||
TEST_SENDMAIL: ${{ vars.TEST_SENDMAIL }}
|
||||
TEST_HOST: ${{ secrets.TEST_HOST }}
|
||||
TEST_USER: ${{ secrets.TEST_USER }}
|
||||
|
@ -145,7 +144,7 @@ jobs:
|
|||
cancel-in-progress: true
|
||||
strategy:
|
||||
matrix:
|
||||
osver: ['14.1', '14.0', 13.4']
|
||||
osver: ['13.4', '14.0', '14.1']
|
||||
steps:
|
||||
- name: Checkout Code
|
||||
uses: actions/checkout@61b9e3751b92087fd0b06925ba6dd6314e06f089 # master
|
||||
|
@ -153,11 +152,9 @@ jobs:
|
|||
uses: vmactions/freebsd-vm@v1
|
||||
with:
|
||||
usesh: true
|
||||
copyback: false
|
||||
prepare: |
|
||||
pkg install -y go
|
||||
run: |
|
||||
cd $GITHUB_WORKSPACE;
|
||||
go test -race -shuffle=on ./...
|
||||
reuse:
|
||||
name: REUSE Compliance Check
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
//
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
//go:build linux || freebsd
|
||||
// +build linux freebsd
|
||||
//go:build !windows
|
||||
// +build !windows
|
||||
|
||||
package mail
|
||||
|
||||
|
@ -18,28 +18,23 @@ import (
|
|||
|
||||
func TestMsg_AttachFile_unixOnly(t *testing.T) {
|
||||
t.Run("AttachFile with fileFromFS fails on open", func(t *testing.T) {
|
||||
if os.Getenv("PERFORM_UNIX_OPEN_WRITE_TESTS") != "true" {
|
||||
t.Skipf("PERFORM_UNIX_OPEN_WRITE_TESTS variable is not set. Skipping unix open/write tests")
|
||||
}
|
||||
|
||||
tempFile, err := os.CreateTemp("testdata/tmp", "attachfile-open-write-test.*.txt")
|
||||
tempfile, err := os.CreateTemp("testdata/tmp", "attachfile-unable-to-open.*.txt")
|
||||
if err != nil {
|
||||
t.Fatalf("failed to create temp file: %s", err)
|
||||
}
|
||||
t.Cleanup(func() {
|
||||
if err := os.Remove(tempFile.Name()); err != nil {
|
||||
if err := os.Remove(tempfile.Name()); err != nil {
|
||||
t.Errorf("failed to remove temp file: %s", err)
|
||||
}
|
||||
})
|
||||
if err = os.Chmod(tempFile.Name(), 0o000); err != nil {
|
||||
t.Fatalf("failed to chmod temp file: %s", err)
|
||||
if err = os.Chmod(tempfile.Name(), 0o000); err != nil {
|
||||
t.Fatalf("failed to chmod temp file to 0000: %s", err)
|
||||
}
|
||||
|
||||
message := NewMsg()
|
||||
if message == nil {
|
||||
t.Fatal("message is nil")
|
||||
}
|
||||
message.AttachFile(tempFile.Name())
|
||||
message.AttachFile(tempfile.Name())
|
||||
attachments := message.GetAttachments()
|
||||
if len(attachments) != 1 {
|
||||
t.Fatalf("failed to get attachments, expected 1, got: %d", len(attachments))
|
Loading…
Reference in a new issue