"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "pkg/test/framework/resource/version.go" between
istio-1.10.0.tar.gz and istio-1.10.1.tar.gz

About: Istio is a platform-independent service mesh that provides a uniform way to connect, secure, control, and observe microservices.

version.go  (istio-1.10.0):version.go  (istio-1.10.1)
skipping to change at line 18 skipping to change at line 18
// //
// Unless required by applicable law or agreed to in writing, software // Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS, // distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
package resource package resource
import ( import (
"fmt"
"strings" "strings"
"istio.io/istio/pilot/pkg/model" "istio.io/istio/pilot/pkg/model"
"istio.io/istio/pkg/test/framework/config" "istio.io/istio/pkg/test/framework/config"
) )
var _ config.Value = &RevVerMap{} var _ config.Value = &RevVerMap{}
// RevVerMap maps installed revisions to their Istio versions. // RevVerMap maps installed revisions to their Istio versions.
type RevVerMap map[string]IstioVersion type RevVerMap map[string]IstioVersion
func (rv *RevVerMap) SetConfig(m config.Map) error { func (rv *RevVerMap) SetConfig(m config.Map) error {
out := make(RevVerMap) out := make(RevVerMap)
for k := range m { for k := range m {
version, err := ParseIstioVersion(m.String(k)) version := m.String(k)
if err != nil { out[k] = IstioVersion(version)
return err
}
out[k] = version
} }
*rv = out *rv = out
return nil return nil
} }
// Set parses IstioVersions from a string flag in the form "a=1.5.6,b=1.9.0,c=1. // Set parses IstioVersions from a string flag in the form "a=1.5.6,b,c=1.4".
4". // If no version is specified for a revision assume latest, represented as ""
func (rv *RevVerMap) Set(value string) error { func (rv *RevVerMap) Set(value string) error {
m := make(map[string]IstioVersion) m := make(map[string]IstioVersion)
rvPairs := strings.Split(value, ",") rvPairs := strings.Split(value, ",")
for _, rvPair := range rvPairs { for _, rv := range rvPairs {
s := strings.Split(rvPair, "=") s := strings.Split(rv, "=")
rev, ver := s[0], s[1] rev := s[0]
parsedVer, err := ParseIstioVersion(ver) if len(s) == 1 {
if err != nil { m[rev] = ""
return err } else if len(s) == 2 {
ver := s[1]
m[rev] = IstioVersion(ver)
} else {
return fmt.Errorf("invalid revision<->version pairing spe
cified: %q", rv)
} }
m[rev] = parsedVer
} }
*rv = m *rv = m
return nil return nil
} }
func (rv *RevVerMap) String() string { func (rv *RevVerMap) String() string {
if rv == nil { if rv == nil {
return "" return ""
} }
var vers []string var rvPairs []string
for _, ver := range *rv { for rev, ver := range *rv {
vers = append(vers, string(ver)) if ver == "" {
ver = "latest"
}
rvPairs = append(rvPairs,
fmt.Sprintf("%s=%s", rev, ver))
} }
return strings.Join(vers, ",") return strings.Join(rvPairs, ",")
} }
// Versions returns an ordered list of Istio versions from the given RevVerMap. // Versions returns an ordered list of Istio versions from the given RevVerMap.
func (rv *RevVerMap) Versions() IstioVersions { func (rv *RevVerMap) Versions() IstioVersions {
if rv == nil { if rv == nil {
return nil return nil
} }
var vers []IstioVersion var vers []IstioVersion
for _, v := range *rv { for _, v := range *rv {
vers = append(vers, v) vers = append(vers, v)
skipping to change at line 139 skipping to change at line 145
} }
min := v[0] min := v[0]
for i := 1; i < len(v); i++ { for i := 1; i < len(v); i++ {
ver := v[i] ver := v[i]
if ver.Compare(min) > 1 { if ver.Compare(min) > 1 {
min = ver min = ver
} }
} }
return min return min
} }
// ParseIstioVersion parses a version string into a IstioVersion.
func ParseIstioVersion(version string) (IstioVersion, error) {
return IstioVersion(version), nil
}
 End of changes. 8 change blocks. 
18 lines changed or deleted 24 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)