From c30913ccdeebb4627a864132e8cd37c5264e88a5 Mon Sep 17 00:00:00 2001 From: Keith Burzinski Date: Mon, 17 Jun 2024 02:23:24 -0500 Subject: [PATCH] [CI-wireguard] Test file consolidation (#6920) --- tests/components/wireguard/common.yaml | 59 ++++++++++++++++++ tests/components/wireguard/test.bk72xx.yaml | 60 +----------------- .../wireguard/test.esp32-c3-idf.yaml | 61 +------------------ tests/components/wireguard/test.esp32-c3.yaml | 61 +------------------ .../components/wireguard/test.esp32-idf.yaml | 60 +----------------- tests/components/wireguard/test.esp32.yaml | 60 +----------------- tests/components/wireguard/test.esp8266.yaml | 60 +----------------- 7 files changed, 65 insertions(+), 356 deletions(-) create mode 100644 tests/components/wireguard/common.yaml diff --git a/tests/components/wireguard/common.yaml b/tests/components/wireguard/common.yaml new file mode 100644 index 0000000000..cd7ab1075e --- /dev/null +++ b/tests/components/wireguard/common.yaml @@ -0,0 +1,59 @@ +wifi: + ssid: "MySSID1" + password: "password1" + +time: + - platform: sntp + +wireguard: + address: 172.16.34.100 + netmask: 255.255.255.0 + # NEVER use the following keys for your VPN -- they are now public! + private_key: wPBMxtNYH3mChicrbpsRpZIasIdPq3yZuthn23FbGG8= + peer_public_key: Hs2JfikvYU03/Kv3YoAs1hrUIPPTEkpsZKSPUljE9yc= + peer_preshared_key: 20fjM5GRnSolGPC5SRj9ljgIUyQfruv0B0bvLl3Yt60= + peer_endpoint: wg.server.example + peer_persistent_keepalive: 25s + peer_allowed_ips: + - 172.16.34.0/24 + - 192.168.4.0/24 + +binary_sensor: + - platform: wireguard + status: + name: 'WireGuard Status' + enabled: + name: 'WireGuard Enabled' + +sensor: + - platform: wireguard + latest_handshake: + name: 'WireGuard Latest Handshake' + +text_sensor: + - platform: wireguard + address: + name: 'WireGuard Address' + +button: + - platform: template + name: 'Toggle WireGuard' + entity_category: config + on_press: + - if: + condition: wireguard.enabled + then: + - wireguard.disable: + else: + - wireguard.enable: + + - platform: template + name: 'Log WireGuard status' + entity_category: config + on_press: + - if: + condition: wireguard.peer_online + then: + - logger.log: 'wireguard remote peer is online' + else: + - logger.log: 'wireguard remote peer is offline' diff --git a/tests/components/wireguard/test.bk72xx.yaml b/tests/components/wireguard/test.bk72xx.yaml index 85325139a9..dade44d145 100644 --- a/tests/components/wireguard/test.bk72xx.yaml +++ b/tests/components/wireguard/test.bk72xx.yaml @@ -1,59 +1 @@ -wifi: - ssid: "MySSID1" - password: "password1" - -time: - - platform: sntp - -wireguard: - address: 172.16.34.100 - netmask: 255.255.255.0 - # NEVER use the following keys for your vpn, they are now public! - private_key: wPBMxtNYH3mChicrbpsRpZIasIdPq3yZuthn23FbGG8= - peer_public_key: Hs2JfikvYU03/Kv3YoAs1hrUIPPTEkpsZKSPUljE9yc= - peer_preshared_key: 20fjM5GRnSolGPC5SRj9ljgIUyQfruv0B0bvLl3Yt60= - peer_endpoint: wg.server.example - peer_persistent_keepalive: 25s - peer_allowed_ips: - - 172.16.34.0/24 - - 192.168.4.0/24 - -binary_sensor: - - platform: wireguard - status: - name: 'WireGuard Status' - enabled: - name: 'WireGuard Enabled' - -sensor: - - platform: wireguard - latest_handshake: - name: 'WireGuard Latest Handshake' - -text_sensor: - - platform: wireguard - address: - name: 'WireGuard Address' - -button: - - platform: template - name: 'Toggle WireGuard' - entity_category: config - on_press: - - if: - condition: wireguard.enabled - then: - - wireguard.disable: - else: - - wireguard.enable: - - - platform: template - name: 'Log WireGuard status' - entity_category: config - on_press: - - if: - condition: wireguard.peer_online - then: - - logger.log: 'wireguard remote peer is online' - else: - - logger.log: 'wireguard remote peer is offline' +<<: !include common.yaml diff --git a/tests/components/wireguard/test.esp32-c3-idf.yaml b/tests/components/wireguard/test.esp32-c3-idf.yaml index 37d1727842..dade44d145 100644 --- a/tests/components/wireguard/test.esp32-c3-idf.yaml +++ b/tests/components/wireguard/test.esp32-c3-idf.yaml @@ -1,60 +1 @@ -wifi: - ssid: MySSID - password: password1 - -time: - - platform: sntp - -wireguard: - id: vpn - address: 172.16.34.100 - netmask: 255.255.255.0 - # NEVER use the following keys for your vpn, they are now public! - private_key: wPBMxtNYH3mChicrbpsRpZIasIdPq3yZuthn23FbGG8= - peer_public_key: Hs2JfikvYU03/Kv3YoAs1hrUIPPTEkpsZKSPUljE9yc= - peer_preshared_key: 20fjM5GRnSolGPC5SRj9ljgIUyQfruv0B0bvLl3Yt60= - peer_endpoint: wg.server.example - peer_persistent_keepalive: 25s - peer_allowed_ips: - - 172.16.34.0/24 - - 192.168.4.0/24 - -binary_sensor: - - platform: wireguard - status: - name: 'WireGuard Status' - enabled: - name: 'WireGuard Enabled' - -sensor: - - platform: wireguard - latest_handshake: - name: 'WireGuard Latest Handshake' - -text_sensor: - - platform: wireguard - address: - name: 'WireGuard Address' - -button: - - platform: template - name: 'Toggle WireGuard' - entity_category: config - on_press: - - if: - condition: wireguard.enabled - then: - - wireguard.disable: - else: - - wireguard.enable: - - - platform: template - name: 'Log WireGuard status' - entity_category: config - on_press: - - if: - condition: wireguard.peer_online - then: - - logger.log: 'wireguard remote peer is online' - else: - - logger.log: 'wireguard remote peer is offline' +<<: !include common.yaml diff --git a/tests/components/wireguard/test.esp32-c3.yaml b/tests/components/wireguard/test.esp32-c3.yaml index 37d1727842..dade44d145 100644 --- a/tests/components/wireguard/test.esp32-c3.yaml +++ b/tests/components/wireguard/test.esp32-c3.yaml @@ -1,60 +1 @@ -wifi: - ssid: MySSID - password: password1 - -time: - - platform: sntp - -wireguard: - id: vpn - address: 172.16.34.100 - netmask: 255.255.255.0 - # NEVER use the following keys for your vpn, they are now public! - private_key: wPBMxtNYH3mChicrbpsRpZIasIdPq3yZuthn23FbGG8= - peer_public_key: Hs2JfikvYU03/Kv3YoAs1hrUIPPTEkpsZKSPUljE9yc= - peer_preshared_key: 20fjM5GRnSolGPC5SRj9ljgIUyQfruv0B0bvLl3Yt60= - peer_endpoint: wg.server.example - peer_persistent_keepalive: 25s - peer_allowed_ips: - - 172.16.34.0/24 - - 192.168.4.0/24 - -binary_sensor: - - platform: wireguard - status: - name: 'WireGuard Status' - enabled: - name: 'WireGuard Enabled' - -sensor: - - platform: wireguard - latest_handshake: - name: 'WireGuard Latest Handshake' - -text_sensor: - - platform: wireguard - address: - name: 'WireGuard Address' - -button: - - platform: template - name: 'Toggle WireGuard' - entity_category: config - on_press: - - if: - condition: wireguard.enabled - then: - - wireguard.disable: - else: - - wireguard.enable: - - - platform: template - name: 'Log WireGuard status' - entity_category: config - on_press: - - if: - condition: wireguard.peer_online - then: - - logger.log: 'wireguard remote peer is online' - else: - - logger.log: 'wireguard remote peer is offline' +<<: !include common.yaml diff --git a/tests/components/wireguard/test.esp32-idf.yaml b/tests/components/wireguard/test.esp32-idf.yaml index 9ea7f00bdb..2798f8e566 100644 --- a/tests/components/wireguard/test.esp32-idf.yaml +++ b/tests/components/wireguard/test.esp32-idf.yaml @@ -1,62 +1,4 @@ -wifi: - ssid: "MySSID1" - password: "password1" +<<: !include common.yaml network: enable_ipv6: true - -time: - - platform: sntp - -wireguard: - address: 172.16.34.100 - netmask: 255.255.255.0 - # NEVER use the following keys for your vpn, they are now public! - private_key: wPBMxtNYH3mChicrbpsRpZIasIdPq3yZuthn23FbGG8= - peer_public_key: Hs2JfikvYU03/Kv3YoAs1hrUIPPTEkpsZKSPUljE9yc= - peer_preshared_key: 20fjM5GRnSolGPC5SRj9ljgIUyQfruv0B0bvLl3Yt60= - peer_endpoint: wg.server.example - peer_persistent_keepalive: 25s - peer_allowed_ips: - - 172.16.34.0/24 - - 192.168.4.0/24 - -binary_sensor: - - platform: wireguard - status: - name: 'WireGuard Status' - enabled: - name: 'WireGuard Enabled' - -sensor: - - platform: wireguard - latest_handshake: - name: 'WireGuard Latest Handshake' - -text_sensor: - - platform: wireguard - address: - name: 'WireGuard Address' - -button: - - platform: template - name: 'Toggle WireGuard' - entity_category: config - on_press: - - if: - condition: wireguard.enabled - then: - - wireguard.disable: - else: - - wireguard.enable: - - - platform: template - name: 'Log WireGuard status' - entity_category: config - on_press: - - if: - condition: wireguard.peer_online - then: - - logger.log: 'wireguard remote peer is online' - else: - - logger.log: 'wireguard remote peer is offline' diff --git a/tests/components/wireguard/test.esp32.yaml b/tests/components/wireguard/test.esp32.yaml index 9ea7f00bdb..2798f8e566 100644 --- a/tests/components/wireguard/test.esp32.yaml +++ b/tests/components/wireguard/test.esp32.yaml @@ -1,62 +1,4 @@ -wifi: - ssid: "MySSID1" - password: "password1" +<<: !include common.yaml network: enable_ipv6: true - -time: - - platform: sntp - -wireguard: - address: 172.16.34.100 - netmask: 255.255.255.0 - # NEVER use the following keys for your vpn, they are now public! - private_key: wPBMxtNYH3mChicrbpsRpZIasIdPq3yZuthn23FbGG8= - peer_public_key: Hs2JfikvYU03/Kv3YoAs1hrUIPPTEkpsZKSPUljE9yc= - peer_preshared_key: 20fjM5GRnSolGPC5SRj9ljgIUyQfruv0B0bvLl3Yt60= - peer_endpoint: wg.server.example - peer_persistent_keepalive: 25s - peer_allowed_ips: - - 172.16.34.0/24 - - 192.168.4.0/24 - -binary_sensor: - - platform: wireguard - status: - name: 'WireGuard Status' - enabled: - name: 'WireGuard Enabled' - -sensor: - - platform: wireguard - latest_handshake: - name: 'WireGuard Latest Handshake' - -text_sensor: - - platform: wireguard - address: - name: 'WireGuard Address' - -button: - - platform: template - name: 'Toggle WireGuard' - entity_category: config - on_press: - - if: - condition: wireguard.enabled - then: - - wireguard.disable: - else: - - wireguard.enable: - - - platform: template - name: 'Log WireGuard status' - entity_category: config - on_press: - - if: - condition: wireguard.peer_online - then: - - logger.log: 'wireguard remote peer is online' - else: - - logger.log: 'wireguard remote peer is offline' diff --git a/tests/components/wireguard/test.esp8266.yaml b/tests/components/wireguard/test.esp8266.yaml index 9ea7f00bdb..2798f8e566 100644 --- a/tests/components/wireguard/test.esp8266.yaml +++ b/tests/components/wireguard/test.esp8266.yaml @@ -1,62 +1,4 @@ -wifi: - ssid: "MySSID1" - password: "password1" +<<: !include common.yaml network: enable_ipv6: true - -time: - - platform: sntp - -wireguard: - address: 172.16.34.100 - netmask: 255.255.255.0 - # NEVER use the following keys for your vpn, they are now public! - private_key: wPBMxtNYH3mChicrbpsRpZIasIdPq3yZuthn23FbGG8= - peer_public_key: Hs2JfikvYU03/Kv3YoAs1hrUIPPTEkpsZKSPUljE9yc= - peer_preshared_key: 20fjM5GRnSolGPC5SRj9ljgIUyQfruv0B0bvLl3Yt60= - peer_endpoint: wg.server.example - peer_persistent_keepalive: 25s - peer_allowed_ips: - - 172.16.34.0/24 - - 192.168.4.0/24 - -binary_sensor: - - platform: wireguard - status: - name: 'WireGuard Status' - enabled: - name: 'WireGuard Enabled' - -sensor: - - platform: wireguard - latest_handshake: - name: 'WireGuard Latest Handshake' - -text_sensor: - - platform: wireguard - address: - name: 'WireGuard Address' - -button: - - platform: template - name: 'Toggle WireGuard' - entity_category: config - on_press: - - if: - condition: wireguard.enabled - then: - - wireguard.disable: - else: - - wireguard.enable: - - - platform: template - name: 'Log WireGuard status' - entity_category: config - on_press: - - if: - condition: wireguard.peer_online - then: - - logger.log: 'wireguard remote peer is online' - else: - - logger.log: 'wireguard remote peer is offline'