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

adding ways to add component info for version mismatch error string #470

Merged
merged 1 commit into from
Aug 26, 2024

Conversation

Vibaswan
Copy link
Collaborator

@Vibaswan Vibaswan commented Aug 23, 2024

new Api exposed SetComponentInformation(clientName, clientAppVersion, ServerName)

sample go test

func TestVersionMismatchMsgWithComponentInfo(t *testing.T) {
	api := apis[0]
	config1 := NewFullyPopulatedPrefixConfig(api)
	config1.SetResponse(openapiart.PrefixConfigResponse.STATUS_200)
	api.SetVersionCompatibilityCheck(true)
	api.GetLocalVersion().SetApiSpecVersion("2.0.1")
	api.SetComponentInformation("keng-controller", "1.8.0", "protocol-engine")
	_, err := api.SetConfig(config1)
	assert.NotNil(t, err)
	assert.Equal(t, err.Error(), "keng-controller 1.8.0 is not compatible with protocol-engine 1.2.3")
	api.SetVersionCompatibilityCheck(false)
}

sample python test

def test_version_mismatch_error(utils, grpc_api):
    with open(utils.get_test_config_path("config.json")) as f:
        payload = json.load(f)
    try:
        grpc_api.get_local_version().api_spec_version = "2.0.1"
        grpc_api._version_check = True
        grpc_api._version_check_err = None
        grpc_api.set_component_info(
            "keng-controller", "1.8.0", "protocol-engine"
        )
        grpc_api.set_config(payload)
        raise Exception("expected version error")
    except Exception as e:
        assert (
            str(e)
            == "keng-controller 1.8.0 is not compatible with protocol-engine 1.2.3"
        )
    finally:
        grpc_api.get_local_version().api_spec_version = "0.1.0"
        grpc_api._version_check = False

@Vibaswan Vibaswan requested a review from alakendu August 23, 2024 05:59
@Vibaswan Vibaswan changed the title adding ways to add component info for version mismatch adding ways to add component info for version mismatch error string Aug 23, 2024
@@ -1045,6 +1050,12 @@ def _get_version_api_interface_method_impl(self, struct_name):
api.versionMeta.checkVersion = v
}}

func (api *{0}) SetComponentInformation(clientName string, clientVer string, serverName string) {{
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is it not possible to get clientVer automatically from Snappi SDK. or it has any specific use case?

@Vibaswan Vibaswan merged commit 5c3e030 into main Aug 26, 2024
15 checks passed
@Vibaswan Vibaswan deleted the extend_component_check branch August 26, 2024 06:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants