Skip to content

Commit

Permalink
Add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
kishikawakatsumi committed Jul 16, 2024
1 parent d4f4fb8 commit 3a2e4dc
Show file tree
Hide file tree
Showing 6 changed files with 87 additions and 0 deletions.
1 change: 1 addition & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
github: kishikawakatsumi
9 changes: 9 additions & 0 deletions .github/renovate.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"extends": ["config:base"],
"packageRules": [
{
"matchUpdateTypes": ["minor", "patch", "pin", "digest"],
"automerge": true
}
]
}
23 changes: 23 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Test
on:
pull_request:
branches: [main]

jobs:
test:
runs-on: macos-13
steps:
- uses: actions/checkout@v4
- name: Test
run: |
set -ex
brew install docker docker-compose
brew install colima
colima start --mount-type 9p
mkdir -p shares/alice
chmod 777 shares/alice
docker compose up --detach
swift test
3 changes: 3 additions & 0 deletions SECURITY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Security Policy

For security related problems, please don't use the public issue tracker, but email [@kishikawakatsumi](https://github.com/kishikawakatsumi).
10 changes: 10 additions & 0 deletions Tests/SMBClientTests/ClientTests.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import XCTest
@testable import SMBClient

final class ClientTests: XCTestCase {
func testLoginSucceeded() async throws {
let client = SMBClient(host: "localhost", port: 4445)
try await client.login(username: "alice", password: "alipass")
try await client.logoff()
}
}
41 changes: 41 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
version: "3"

services:
samba:
build: .
image: ghcr.io/servercontainers/samba
ports:
- "139:139"
- "4445:445"
environment:
SAMBA_CONF_LOG_LEVEL: 3
AVAHI_DISABLE: 1

GROUP_family: 1500

ACCOUNT_alice: alipass
UID_alice: 1000
GROUPS_alice: family

ACCOUNT_bob: bobpass
UID_bob: 1001
GROUPS_bob: family

SAMBA_VOLUME_CONFIG_shared_home: "[Home]; path=/shares/homes/%U; valid users = alice, bob; guest ok = no; read only = no; browseable = yes"

SAMBA_VOLUME_CONFIG_aliceonly: "[Alice Share]; path=/shares/alice; valid users = alice; guest ok = no; read only = no; browseable = yes"
SAMBA_VOLUME_CONFIG_alicehidden: "[Alice Hidden Share]; path=/shares/alice-hidden; valid users = alice; guest ok = no; read only = no; browseable = no"

SAMBA_VOLUME_CONFIG_bobonly: "[Bob Share]; path=/shares/bob; valid users = bob; guest ok = no; read only = no; browseable = yes"

SAMBA_VOLUME_CONFIG_public: "[Public]; path=/shares/public; valid users = alice, bob, foo; guest ok = no; read only = no; browseable = yes; force group = family"
SAMBA_VOLUME_CONFIG_public_ro: "[Public ReadOnly]; path=/shares/public; guest ok = yes; read only = yes; browseable = yes; force group = family"

SAMBA_VOLUME_CONFIG_guestmultilineexample: |
[Guest Share]
path = /shares/guest
guest ok = yes
browseable = yes
volumes:
- ./shares/alice:/shares/alice

0 comments on commit 3a2e4dc

Please sign in to comment.