Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added cloud2edge setup script for integration testing #127

Merged
merged 40 commits into from
Nov 29, 2022
Merged
Changes from 1 commit
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
a6389a6
[#126] Added cloud2edge setup script for integration testing
nzhechev-bosch Sep 13, 2022
c9db89e
[#126] Suite connector certificate and log files made configurable
nzhechev-bosch Sep 15, 2022
fc8a195
[#126] Added config properties for registry user/password
nzhechev-bosch Sep 15, 2022
39ec31a
[#126] Replaced host/port property pairs with address properties
nzhechev-bosch Sep 16, 2022
e07009a
[#126] Fixed help for config properties with empty default values
nzhechev-bosch Sep 23, 2022
b9bfeb7
[#126] Include notes for new dependencies
Oct 19, 2022
5d86d54
[#126] Fix dependent device deletion by including the colon in the pr…
Oct 19, 2022
cde33c4
[#126] Stop creating and deleting policies,
Oct 21, 2022
2d1c2cc
[#126] Do not use a prefix for env variables
Oct 25, 2022
a6e363b
[#126] Address code review comments
Nov 1, 2022
33dbd85
[#126] Address code review comments and minor improvements
Nov 2, 2022
c0d09f9
[#126] Address code review comments and minor improvements
Nov 3, 2022
dad005b
[#126] Fix go vet and golint issues
Nov 3, 2022
b2efa74
[#126] Make suite-connector configuration and configuration backup pa…
Nov 3, 2022
11a8fe7
[#126] Run go mod tidy
Nov 3, 2022
35df9cc
[#126] Address code review feedback
Nov 8, 2022
4bd5c57
[#126] Rebase
Nov 14, 2022
b33f2c9
[#126] Refactor to use the integration test common code.
Nov 14, 2022
07f84f7
[#126] Properly display the default values of environment variables.
Nov 14, 2022
11053e2
[#126] Change the help message for the command-line parameters -confi…
Nov 23, 2022
49f1158
[#126] Pick up the latest integration test common logic dependency.
Nov 23, 2022
e6f2455
[#126] Refactor the code to use the newly available functionality in …
Nov 23, 2022
828f581
[#126] Rename module and directory c2esetup to c2e-setup.
Nov 23, 2022
dbc8d1b
[126] Rebase and pick up the latest util dependency.
Nov 25, 2022
2c12e6d
[126] Refactor to use fewer fmt.Sprintf() calls.
Nov 25, 2022
ed74784
[126] Pick up the latest util dependency.
Nov 25, 2022
86b5192
[126] Fix the copyright year.
Nov 25, 2022
56db3ba
[126] Address code review comments and minor fixes.
Nov 28, 2022
70ac3ce
[126] Address a code review comment.
Nov 28, 2022
f287d3c
[126] Address a code review comment.
Nov 28, 2022
6ccc0af
[126] Address a code review comment.
Nov 29, 2022
d8880fd
[126] Address a code review comment.
Nov 29, 2022
440c717
[126] Address code review comments.
Nov 29, 2022
12c7d62
[126] Address code review comments.
Nov 29, 2022
54de759
[126] Remove three dependencies, which aren't in the binary, from NOT…
Nov 29, 2022
b3dea8b
[126] NOTICE.md formatting changes.
Nov 29, 2022
76206bf
[126] NOTICE.md formatting changes.
Nov 29, 2022
82b5218
[126] NOTICE.md formatting changes.
Nov 29, 2022
2050911
[126] NOTICE.md formatting changes.
Nov 29, 2022
2871fbf
[126] NOTICE.md formatting changes.
Nov 29, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
[#126] Make suite-connector configuration and configuration backup pa…
…rameters optional

Signed-off-by: Dimiter Georgiev <dimiter.georgiev@bosch.io>
  • Loading branch information
Dimiter Georgiev committed Nov 25, 2022
commit b2efa74178dd36322182a0871fd69e5dff3ac308
66 changes: 34 additions & 32 deletions integration/c2esetup/main.go
Original file line number Diff line number Diff line change
@@ -15,7 +15,6 @@ package main
import (
"bytes"
"encoding/json"
"errors"
"flag"
"fmt"
"io"
@@ -246,6 +245,16 @@ func performSetUp(deviceResource *resource, resources []*resource) int {

fmt.Println("performing setup...")

if configFile != "" && configFileBackup != "" {
fmt.Println("saving a backup of the suite-connector configuration file...")
if err := copyFile(configFile, configFileBackup); err != nil {
fmt.Printf(
"unable to save backup copy of configuration file %s to %s: %v\n",
configFile, configFileBackup, err)
return 1
}
}

for i, r := range resources {
url := fmt.Sprintf("%s/%s", r.base, r.path)

@@ -272,26 +281,19 @@ func performSetUp(deviceResource *resource, resources []*resource) int {
return 1
}

if err := copyFile(configFile, configFileBackup); err != nil {
fmt.Printf(
"unable to save backup copy of configuration file %s to %s: %v\n",
configFile, configFileBackup, err)

deleteResources(resources)
return 1
}
var code int
if configFile != "" {
if err := writeConfigFile(configFile); err != nil {
fmt.Println(err)

if err := writeConfigFile(configFile); err != nil {
fmt.Println(err)
deleteResources(resources)
return 1
}

deleteResources(resources)
return 1
fmt.Printf("%s configuration file '%s' written\n", indent, configFile)
code = restartSuiteConnector()
}

fmt.Printf("%s configuration file '%s' written\n", indent, configFile)

code := restartSuiteConnector()

if code == 0 {
fmt.Println("setup successful")
}
@@ -301,21 +303,21 @@ func performSetUp(deviceResource *resource, resources []*resource) int {

func performCleanUp(resources []*resource) int {
var code int
fmt.Println("restoring suite-connector configuration file and restarting suite-connector")
if err := copyFile(configFileBackup, configFile); err != nil {
fmt.Printf(
"unable to restore the backup copy of configuration file %s to %s: %v\n",
configFileBackup, configFile, err)
code = 1
} else {
code = restartSuiteConnector()
}
if code == 0 {
// Delete suite-connector configuration backup file
if _, err := os.Stat(configFileBackup); errors.Is(err, os.ErrNotExist) {
fmt.Printf("unable to delete configuration file backup %s, file does not exist: %v", configFileBackup, err)
} else if err := os.Remove(configFileBackup); err != nil {
fmt.Printf("unable to delete configuration file backup %s, error: %v", configFileBackup, err)
if configFile != "" && configFileBackup != "" {
fmt.Println("restoring suite-connector configuration file and restarting suite-connector")
if err := copyFile(configFileBackup, configFile); err != nil {
fmt.Printf(
"unable to restore the backup copy of configuration file %s to %s: %v\n",
configFileBackup, configFile, err)
code = 1
} else {
code = restartSuiteConnector()
}
if code == 0 {
// Delete suite-connector configuration backup file
if err := os.Remove(configFileBackup); err != nil {
fmt.Printf("unable to delete configuration file backup %s, error: %v", configFileBackup, err)
}
}
}
// Delete devices and things