NCNU-OpenSource
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Owners
        • Signed-in users
        • Everyone
        Owners Signed-in users Everyone
      • Write
        • Owners
        • Signed-in users
        • Everyone
        Owners Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee

      This note has no invitees

    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Note Insights
    • Engagement control
    • Transfer ownership
    • Delete this note
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Versions and GitHub Sync Note Insights Sharing URL Help
Menu
Options
Engagement control Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Owners
  • Owners
  • Signed-in users
  • Everyone
Owners Signed-in users Everyone
Write
Owners
  • Owners
  • Signed-in users
  • Everyone
Owners Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       owned this note    owned this note      
    Published Linked with GitHub
    Subscribed
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    Subscribe
    --- tags: 1082, lsa --- - Book mode https://hackmd.io/@ncnu-opensource/book # Week 11 (2020/5/14) - Book mode https://hackmd.io/@ncnu-opensource/By4H6JLNW ## 測試, CI/CD 後半 ### 自動化測試 ![](https://imsardine.github.io/images/testing-pyramid.png) - 越上層涵蓋越多,成本越高 - 要注意金字塔比例 (金字塔是自然產生的) - 變成沙漏型,代表基礎測試不夠 - 如果上面的測試有 fail 可能抓不到是哪個 module 錯誤等等 - 單元測試 (Unit Test) - independent: 相依性太高 就會不知道出錯的部份 - 整合測試 (Intergration Test) - 通過了單元測試,代表每個元件都是正常的,但可能相互運作是不合理的 - 端對端測試 (End to End, E2E) - 其他測試: - 用戶接受度測試 UAT:是測試的一個階段, UAT 測試之前僅確認有沒有依照規格開發,使用 UAT 是確認規格是否適用執行 - 回歸測試:要確定舊版本正常運行才可以加上新版本(新版本不能影響舊版本) ### Git - 安裝 Git - `sudo apt install git` - 建立專案資料夾 - `mkdir <專案名稱>` - 把專案資料夾建立成 git 的 repo - 切進專案資料夾 - `cd <專案名稱>` - `git init` - 會產生一個 .git 的目錄 - 檢查本機端的 repo 狀態和遠端的狀態差別 - `git status` - 更新遠端的變動(讓本機能看到) - `git fetch` - 將專案中做過的更改準備 commit - `git add <檔案名>` - `git add .` (把所有更改都加進去) - add 前應先用 `git status` 看哪些被更改後,再 add 特定檔案 - 將已經加入的更改 commit 到 repo 中 - `git commit -m "<留言 你做了什麼更改之類>"` - 盡量不要使用 `commit -a` - 將 commit 推送到 repo 中 - `git push` - 更新本機端的狀態(from master branch) - `git pull` - git 會把 reference 存在 refs 裡 ## 網路安全規劃 - 效能 - 追查網路封包到很細的時候,是追出 one way,而不是 Round-Trip Time ## 學長分享 - docker ### 環境要求 - curl with docker daemon - 開啟 cgroup 和 swaps - cgroup 預設不會開啟 ### 指令查看相關資訊 - `sudo lsb_release -a` 看 ubuntu 版本 - network plungin - `sudo systemctl status docker` 看 docker 運行的狀況 - 有常駐的監聽 socket - `| jq .` 輸出 command line 較好看 - `ps auxf` 可看到 process 的 parent/child 關係 - `/proc` 所有 PID 掛載的位置 - `sudo docker run <image>` - `--rm` exit 或 stop 就不會在 `docker ps -a` 中看到 - `-m <memory_set>` 限制 memory(hard limit) - 超過會觸發 OOM :::info limit (memory) 可用 `stress-ng` 強迫壓測 再去 `/var/log/syslog` 去查看事件 - 被 cgroup 監控,並被 kill 掉 ::: - `docker inspect <container_name>` 偵查 Container 的細部資訊 ### docker - cgroup - kernel 2.2 - capabilities - logPath (`docker inspect <Container_name>` 查看) - STDOUT ( CMD 根據 command ouput 出的內容) 跟 STDIN ( CMD 下的指令 ) - log driver - type : j-son file - Container 可能有不同的 plugin 用不同 type 的 type - storage - 支援不同的 protocol -> 不同 storage 的 driver - pull 時跑很 layer 是什麼意思 - 可從 `/var/lib/docker/overlay2` 下指定的 Container ID 看到 (未必是 overlay2) - `docker history <docker_name>` 安裝的歷史訊息,可以看到 image 有哪幾層 - 將不同的 layer 疊加起來 會用 soft link 的方式存放在一個目錄底下 - namspace - 縮寫 `netns` - `ip netns list` 是看不到任何訊息的 - 需要再做 soft link ### 問題 - docker stop 為什麼可以停止一個 Container? - 送個 SIGTERM 告訴 container 你該關掉囉 大概 10 秒(grace time)後 parent process 就會再送 SIGKILL 強制關閉 - exit code - bash trap signal - docker 上的 PID 怎跟 host 上的 PID mapping 的 - `/proc` (? - 會有個目錄結構 裡面有 PID 相關內容

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password

    or

    By clicking below, you agree to our terms of service.

    Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully