Allow marking tests to be skipped (#16528)

This commit is contained in:
andig 2024-10-06 13:45:38 +02:00 • committed by GitHub
parent ec1f09307c
commit 8cc3b0f4d2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
21 changed files with 38 additions and 20 deletions

View file

@ -23,7 +23,8 @@ var acceptable = []string{
"loadpoint 1 is not configured", // openWB
"recv timeout",
"(Client.Timeout exceeded while awaiting headers)",
"can only have either uri or device", // modbus
"can only have either uri or device", // modbus
"connection already registered with different protocol: localhost:502", // modbus
"sponsorship required, see https://github.com/evcc-io/evcc#sponsorship",
"eebus not configured",
"context deadline exceeded",

View file

@ -23,12 +23,13 @@ var acceptable = []string{
"i/o timeout",
"'sma': missing uri or serial", // SMA
"[1ESY1161052714 1ESY1161229249 1EMH0008842285 1ESY1161978584 1EMH0004864048 1ESY1161979033 7ELS8135823805]", // Discovergy
"can only have either uri or device", // modbus
"(Client.Timeout exceeded while awaiting headers)", // http
"context deadline exceeded", // LG ESS
"no ping response for 192.0.2.2", // SMA
"no such network interface", // SMA
"missing config values: username, password, key", // E3DC
"can only have either uri or device", // modbus
"connection already registered with different protocol: localhost:502", // modbus
"(Client.Timeout exceeded while awaiting headers)", // http
"context deadline exceeded", // LG ESS
"no ping response for 192.0.2.2", // SMA
"no such network interface", // SMA
"missing config values: username, password, key", // E3DC
}
func TestTemplates(t *testing.T) {

View file

@ -4,7 +4,7 @@ products:
description:
generic: TerraAC
requirements:
evcc: ["sponsorship"]
evcc: ["sponsorship", "skiptest"]
params:
- preset: ocpp
render: |

View file

@ -4,7 +4,7 @@ products:
description:
generic: Elvi
requirements:
evcc: ["sponsorship"]
evcc: ["sponsorship", "skiptest"]
params:
- preset: ocpp
- name: meter

View file

@ -3,6 +3,8 @@ products:
- brand: Fronius
description:
generic: Wattpilot (OCPP)
requirements:
evcc: ["sponsorship", "skiptest"]
params:
- preset: ocpp
render: |

View file

@ -13,7 +13,7 @@ requirements:
The charger must be equipped with a built-in meter (models HC11L/HC22L Energy or Profi).
For the OCPP configuration, you need to access the EFR-SECC charge controller at http://host/secc.
For login credentials, ask your dealer or the vendor EFR (www.efr.de).
evcc: ["sponsorship"]
evcc: ["sponsorship", "skiptest"]
params:
- preset: ocpp
render: |

View file

@ -4,7 +4,7 @@ products:
description:
generic: Viaris
requirements:
evcc: ["sponsorship"]
evcc: ["sponsorship", "skiptest"]
params:
- preset: ocpp
render: |

View file

@ -19,7 +19,7 @@ requirements:
* URL: ws://[evcc-adresse]:8887/ (local network connection)
* Charge Point Identity: Custom value (e.g. serial number of charger) which is reused in configuration as *stationid*
* Password: leave empty
evcc: ["sponsorship"]
evcc: ["sponsorship", "skiptest"]
params:
- preset: ocpp
render: |

View file

@ -47,7 +47,7 @@ requirements:
* Local network connection
The specific configuration and the actual usable functionality depend on the charger model and its software.
evcc: ["sponsorship"]
evcc: ["sponsorship", "skiptest"]
params:
- preset: ocpp
- name: autostart

View file

@ -13,6 +13,7 @@ requirements:
description:
en: WARP Firmware v2 required. Automatic phase switching requires the additional WARP Energy Manager.
de: WARP Firmware v2 erforderlich. Für automatische Phasenumschaltung wird zusätzlich der WARP Energy Manager benötigt.
evcc: ["skiptest"]
params:
- preset: mqtt
- name: topic

View file

@ -11,6 +11,7 @@ requirements:
description:
de: Die automatische Phasenumschaltung bei 1p Fahrzeugen muss deaktiviert sein. Siehe https://docs.warp-charger.com/docs/mqtt_http/api_reference/evse#evse_phase_auto_switch_warp3.
en: The automatic phase switching for 1p vehicles must be deactivated. Siehe https://docs.warp-charger.com/docs/mqtt_http/api_reference/evse#evse_phase_auto_switch_warp3.
evcc: ["skiptest"]
params:
- preset: mqtt
- name: topic

View file

@ -3,6 +3,8 @@ products:
- brand: Solaranzeige
description:
generic: Solaranzeige
requirements:
evcc: ["skiptest"]
params:
- name: usage
choice: ["grid", "pv"]

View file

@ -3,6 +3,8 @@ products:
- brand: Tibber
description:
generic: Pulse
requirements:
evcc: ["skiptest"]
params:
- name: usage
choice: ["grid"]

View file

@ -3,6 +3,8 @@ products:
- brand: Volkszähler
description:
generic: WebSocket API
requirements:
evcc: ["skiptest"]
group: generic
params:
- name: usage

View file

@ -7,6 +7,7 @@ requirements:
description:
de: "CO₂-Daten für viele Länder von https://electricitymaps.com/. Der 'Free Personal Tier' beinhaltet leider keine Prognosedaten. Dafür benötigst du einen kommerziellen Account von https://api-portal.electricitymaps.com/. Kostenloser Testmonat verfügbar."
en: "CO₂ data for many countries from https://electricitymaps.com/. The 'Free Personal Tier' unfortunately does not include forecast data. You'll need a commercial account from https://api-portal.electricitymaps.com/. Free trial available."
evcc: ["skiptest"]
group: co2
params:
- name: uri

View file

@ -7,6 +7,7 @@ requirements:
description:
de: "Nur für die Schweiz verfügbar."
en: "Only available for Switzerland."
evcc: ["skiptest"]
group: price
params:
- preset: tariff-base

View file

@ -5,6 +5,7 @@ requirements:
description:
de: "Regionale Emissionsdaten von https://gruenstromindex.de. Nur für Deutschland verfügbar."
en: "Regional emission data from https://gruenstromindex.de. Only available for Germany."
evcc: ["skiptest"]
group: co2
params:
- name: zip

View file

@ -5,6 +5,7 @@ requirements:
description:
en: "Get your API token from the Tibber developer portal: https://developer.tibber.com/"
de: "Hol dir deinen API-Token aus dem Tibber-Entwicklerportal: https://developer.tibber.com/"
evcc: ["skiptest"]
group: price
params:
- name: token

View file

@ -2,7 +2,6 @@ package templates
import (
"maps"
"os"
"slices"
"testing"
@ -27,10 +26,12 @@ func test(t *testing.T, tmpl Template, values map[string]interface{}, cb func(va
return
}
// actually run the instance if not on CI
if os.Getenv("CI") == "" {
cb(values)
// don't execute if skip test is set
if slices.Contains(tmpl.Requirements.EVCC, RequirementSkipTest) {
return
}
cb(values)
}
func TestClass(t *testing.T, class Class, instantiate func(t *testing.T, values map[string]interface{})) {

View file

@ -56,9 +56,10 @@ const (
RequirementEEBUS = "eebus" // EEBUS Setup is required
RequirementMQTT = "mqtt" // MQTT Setup is required
RequirementSponsorship = "sponsorship" // Sponsorship is required
RequirementSkipTest = "skiptest" // Template should be rendered but not tested
)
var ValidRequirements = []string{RequirementEEBUS, RequirementMQTT, RequirementSponsorship}
var ValidRequirements = []string{RequirementEEBUS, RequirementMQTT, RequirementSponsorship, RequirementSkipTest}
var predefinedTemplateProperties = []string{
"type", "template", "name",

View file

@ -22,9 +22,9 @@ var acceptable = []string{
"missing credentials", // Tesla
"missing credentials id", // Tronity
"missing access and/or refresh token, use `evcc token` to create", // Tesla
"login failed: code not found", //Polestar
"login failed: code not found", // Polestar
"empty instance type- check for missing usage", // Merces
"invalid vehicle type: tesla", //Tesla
"invalid vehicle type: tesla", // Tesla
}
func TestTemplates(t *testing.T) {