edgexfoundry / edgex-taf

Apache License 2.0
11 stars 24 forks source link

Add TAF tests for URI for Files #863

Closed lenny-goodell closed 1 year ago

lenny-goodell commented 1 year ago

See ADR here: https://docs.edgexfoundry.org/3.0/design/adr/0027-URIs%20for%20Files/

See PRs here:

cherrycl commented 1 year ago

Test Coverage

Test UoM URI with username-password in URI(non-secty)

  1. Set environment variable UOM_UOMFile under core-metadata to use the file which located on remote http server
  2. Deploy EdgeX
  3. Get UOM by API request and validate the response is correct

Test UoM URI with secret credentials(secty)

  1. Store remote server secret to core-metadata with the following data
    type=httpheader
    headername=Authorization
    headercontents=Basic bXl1c2VyOm15cGFzc3dvcmQ=
  2. Update UoMFile path from consul to use the file which located on remote http server
  3. Restart core-metadata
  4. Get UOM by API request and validate the response is correct

Test configuration file, device profiles, devices and provision watchers with username-password in URI (non-secty)

  1. Set EDGEX_CONFIG_FILE on device-onvif-camera to use the file which located on remote http server
  2. Update the configuration file for DEVICE > PROFILESDIR, DEVICESDIR, and PROVISIONWATCHERSDIR to use the file which located on remote http server. examples
    PROFILESDIR="http://example.com/devices/profile.json"
    DEVICESDIR="http://example.com/devices/device.json"
    PROVISIONWATCHERSDIR="http://example.com/devices/provisionwatcher.json"
  3. Deploy EdgeX with device-onvif-camera
  4. Get device profiles, devices, and provision watchers by API request and validate the all metadata are created

Test common configuration file (non-secty)

  1. Set EDGEX_COMMON_CONFIG to use the file which located on remote http server under core-common-config-bootstrapper in compose file
  2. Set EDGEX_CONFIG_PROVIDER: none under core-common-config-bootstrapper in compose file
  3. Deploy EdgeX by the compose file

@lenny-intel Would you please help review the test coverage for URI for Files? Please let me know if any concerns. Thank you

lenny-goodell commented 1 year ago

@cherrycl , basic UOM cases looks good. but please specify that the remote http server requires basic auth and that the secret data is stored for Core Metadata. On the Device service file please specify that the remote http server has the index file for each type that contains the the list of files to load for that file type.

Also, we need case for configuration files (private and common) https://github.com/edgexfoundry/go-mod-bootstrap/pull/558 EDGEX_CONFIG_FILE for private and EDGEX_COMMON_CONFIG for common. You will need to set EDGEX_CONFIG_PROVIDER to none when using EDGEX_COMMON_CONFIG for common so Consul isn't used to get the common config. You can set EDGEX_COMMON_CONFIG=https://raw.githubusercontent.com/edgexfoundry/edgex-go/main/cmd/core-common-config-bootstrapper/res/configuration.yaml Use similar for approach for private.

ejlee3 commented 1 year ago

one more missing PR for URI4Files - this is the implementation for device files:

cherrycl commented 1 year ago

@lenny-intel I tried to deploy services by the compose file which adding the variables under core-common-config-bootstrapper.

EDGEX_COMMON_CONFIG: https://raw.githubusercontent.com/edgexfoundry/edgex-go/main/cmd/core-common-config-bootstrapper/res/configuration.yaml
EDGEX_CONFIG_PROVIDER: none

But got error

level=INFO ts=2023-08-24T03:28:40.601269647Z app=core-common-config-bootstrapper source=config.go:630 msg="Using Configuration provider () from: http://:0 with base path of edgex/v3/core-common-config-bootstrapper"
level=ERROR ts=2023-08-24T03:28:40.601278723Z app=core-common-config-bootstrapper source=main.go:97 msg="failed to create provider client for the common configuration: unable to create Configuration Client: Configuration service host and/or port or serviceKey not set"

Is this an issue or I put the variables to incorrect service?

cherrycl commented 1 year ago

@lenny-intel The comment for test scenarios were updated.

  1. Test UoM URI with username-password in URI (non-secty test) and Test UoM URI with secret credentials (secty test), both are UoM test.
  2. Private configuration file, Test configuration file, device profiles, devices and provision watchers with username-password in URI. This includes profile, device and provision watchers remote URI test.
  3. Add test Test common configuration file. Need to confirm the correct behavior.
cherrycl commented 1 year ago

@lenny-intel I am not sure the usage of EDGEX_COMMON_CONFIG and EDGEX_CONFIG_PROVIDER. Would you please help me to review the following scenario for the variables?

  1. Set the following variable on compose file under core-data service to overwrite the environment variable
    EDGEX_COMMON_CONFIG: https://raw.githubusercontent.com/edgexfoundry/edgex-go/main/cmd/core-common-config-bootstrapper/res/configuration.yaml
    EDGEX_CONFIG_PROVIDER: none
    DATABASE_HOST: edgex-redis
    MESSAGEBUS_HOST: edgex-redis
    REGISTRY_HOST: edgex-core-consul
  2. Deploy EdgeX
  3. Validate the core-data can't be found from Consul and service still works fine. (To be confirmed)

Thanks.

cloudxxx8 commented 1 year ago

@lenny-intel I tried to deploy services by the compose file which adding the variables under core-common-config-bootstrapper.

EDGEX_COMMON_CONFIG: https://raw.githubusercontent.com/edgexfoundry/edgex-go/main/cmd/core-common-config-bootstrapper/res/configuration.yaml
EDGEX_CONFIG_PROVIDER: none

But got error

level=INFO ts=2023-08-24T03:28:40.601269647Z app=core-common-config-bootstrapper source=config.go:630 msg="Using Configuration provider () from: http://:0 with base path of edgex/v3/core-common-config-bootstrapper"
level=ERROR ts=2023-08-24T03:28:40.601278723Z app=core-common-config-bootstrapper source=main.go:97 msg="failed to create provider client for the common configuration: unable to create Configuration Client: Configuration service host and/or port or serviceKey not set"

Is this an issue or I put the variables to incorrect service?

I've discussed with Cherry. These envrionment variables should not be defined in the core-common-config-bootstrapper service. They should be defined in the individual service. Thus, there is no problem now.