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

Windows compilation: Ensure thrift_proxy tests/mocks do not fail to compile with missing Validate method on google::protobuf::Struct #10780

Merged
merged 4 commits into from
Apr 16, 2020
Merged

Conversation

sunjayBhatia
Copy link
Member

@sunjayBhatia sunjayBhatia commented Apr 14, 2020

Description:

  • ThriftFilters::FactoryBase.createFilterFactoryFromProto() calls protobuf
    utility validation (Validate() method) on the template parameter class
    ConfigProto
  • The mocks set the template parameter to be google::protobuf::Struct
    and MSVC cannot find a Validate() method for that type
  • Instead, we match the structure of the dubbo_proxy test mocks that
    mock a helper template class similar to FactoryBase that does call any
    protobuf validation code, bypassing the need for Validate() on
    google::protobuf::Struct

Risk Level: Low
Testing: Modifies existing test mocks
Docs Changes: N/A
Release Notes: N/A

- ThriftFilters::FactoryBase.createFilterFactoryFromProto() calls protobuf
  utility validation (Validate() method) on the template parameter class
  ConfigProto
- The mocks set the template parameter to be google::protobuf::Struct
  and MSVC cannot find a Validate() method for that type
- Instead, we match the structure of the dubbo_proxy test mocks that
  mock a helper template class similar to FactoryBase that does call any
  protobuf validation code, bypassing the need for Validate() on
  google::protobuf::Struct

Co-authored-by: William A Rowe Jr <wrowe@pivotal.io>
Signed-off-by: William A Rowe Jr <wrowe@pivotal.io>
Co-authored-by: Sunjay Bhatia <sbhatia@pivotal.io>
Signed-off-by: Sunjay Bhatia <sbhatia@pivotal.io>
@sunjayBhatia
Copy link
Member Author

It is not apparent that google::protobuf::Struct has any validation code generated by PGV or otherwise, so not really sure how this is working with clang/gcc tbh

@sunjayBhatia
Copy link
Member Author

#10542 has the same changes, pulled this out of that PR so we can discuss further

@sunjayBhatia
Copy link
Member Author

/retest

@repokitteh-read-only
Copy link

🔨 rebuilding ci/circleci: coverage (failed build)

🐱

Caused by: a #10780 (comment) was created by @sunjayBhatia.

see: more, trace.

Signed-off-by: Sunjay Bhatia <sbhatia@pivotal.io>
@sunjayBhatia
Copy link
Member Author

for reference, here is the full compilation failure output before this change:

ERROR: C:/workspace/envoy/test/extensions/filters/network/thrift_proxy/BUILD:124:1: C++ compilation of rule '//test/extensions/filters/network/thrift_proxy:header_transport_impl_test_lib_internal_only' failed (Exit 2): cl.exe failed: error executing com
mand
  cd C:/_eb/execroot/envoy
  SET BAZEL_LINKLIBS=-l%:libstdc++.a
    SET BAZEL_LINKOPTS=-lm
    SET INCLUDE=C:\var\vcap\data\VSBuildTools\2019\VC\Tools\MSVC\14.25.28610\include;C:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\include\um;C:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\ucrt;C:\Program Files (x86)\Windows Kits\10\incl
ude\10.0.18362.0\shared;C:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\um;C:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\winrt;C:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\cppwinrt
    SET PATH=C:\var\vcap\data\VSBuildTools\2019\VC\Tools\MSVC\14.25.28610\bin\HostX64\x64;C:\var\vcap\data\VSBuildTools\2019\Common7\IDE\VC\VCPackages;C:\var\vcap\data\VSBuildTools\2019\Common7\IDE\CommonExtensions\Microsoft\TestWindow;C:\var\vcap\data\
VSBuildTools\2019\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer;C:\var\vcap\data\VSBuildTools\2019\MSBuild\Current\bin\Roslyn;C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.8 Tools\x64\;C:\Program Files (x86)\Wind
ows Kits\10\bin\10.0.18362.0\x64;C:\Program Files (x86)\Windows Kits\10\bin\x64;C:\var\vcap\data\VSBuildTools\2019\\MSBuild\Current\Bin;C:\Windows\Microsoft.NET\Framework64\v4.0.30319;C:\var\vcap\data\VSBuildTools\2019\Common7\IDE\;C:\var\vcap\data\VSBu
ildTools\2019\Common7\Tools\;;C:\Windows\system32;C:\var\vcap\data\VSBuildTools\2019\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin;C:\var\vcap\data\VSBuildTools\2019\Common7\IDE\CommonExtensions\Microsoft\CMake\Ninja
    SET PWD=/proc/self/cwd
    SET TEMP=C:\Windows\TEMP
    SET TMP=C:\Windows\TEMP
    SET TMPDIR=C:\Windows\TEMP
  C:/var/vcap/data/VSBuildTools/2019/VC/Tools/MSVC/14.25.28610/bin/HostX64/x64/cl.exe @bazel-out/x64_windows-opt/bin/test/extensions/filters/network/thrift_proxy/_objs/header_transport_impl_test_lib_internal_only/header_transport_impl_test.obj.params
Execution platform: @local_config_platform//:host
bazel-out/x64_windows-opt/bin/source/common/protobuf/_virtual_includes/utility_lib\common/protobuf/utility.h(253): error C3861: 'Validate': identifier not found
bazel-out/x64_windows-opt/bin/source/common/protobuf/_virtual_includes/utility_lib\common/protobuf/utility.h(278): note: see reference to function template instantiation 'void Envoy::MessageUtil::validate<ConfigProto>(const MessageType &,Envoy::Protobuf
Message::ValidationVisitor &)' being compiled
        with
        [
            ConfigProto=google::protobuf::Struct,
            MessageType=google::protobuf::Struct
        ]
bazel-out/x64_windows-opt/bin/source/extensions/filters/network/thrift_proxy/filters/_virtual_includes/factory_base_lib\extensions/filters/network/thrift_proxy/filters/factory_base.h(20): note: see reference to function template instantiation 'MessageTy
pe Envoy::MessageUtil::downcastAndValidate<const ConfigProto&>(const google::protobuf::Message &,Envoy::ProtobufMessage::ValidationVisitor &)' being compiled
        with
        [
            MessageType=const google::protobuf::Struct &,
            ConfigProto=google::protobuf::Struct
        ]
bazel-out/x64_windows-opt/bin/source/extensions/filters/network/thrift_proxy/filters/_virtual_includes/factory_base_lib\extensions/filters/network/thrift_proxy/filters/factory_base.h(18): note: while compiling class template member function 'Envoy::Exte
nsions::NetworkFilters::ThriftProxy::ThriftFilters::FilterFactoryCb Envoy::Extensions::NetworkFilters::ThriftProxy::ThriftFilters::FactoryBase<google::protobuf::Struct>::createFilterFactoryFromProto(const google::protobuf::Message &,const std::string &,
Envoy::Server::Configuration::FactoryContext &)'
.\test/extensions/filters/network/thrift_proxy/mocks.h(289): note: see reference to class template instantiation 'Envoy::Extensions::NetworkFilters::ThriftProxy::ThriftFilters::FactoryBase<google::protobuf::Struct>' being compiled

MockFilterConfigFactory implements NamedThriftFilterConfigFactory

Signed-off-by: Sunjay Bhatia <sbhatia@pivotal.io>
Signed-off-by: Sunjay Bhatia <sbhatia@pivotal.io>
@zuercher
Copy link
Member

Thanks! This kooks good. Not sure what the coverage failure is, though seems unrelated. to your change. Depending on how out-of-date your branch is, merging master might help, but it's not a failure I recognize.

@sunjayBhatia
Copy link
Member Author

/retest

@repokitteh-read-only
Copy link

🔨 rebuilding ci/circleci: coverage (failed build)

🐱

Caused by: a #10780 (comment) was created by @sunjayBhatia.

see: more, trace.

@sunjayBhatia
Copy link
Member Author

@zuercher hmmm, I kicked off the build again, I don’t remember seeing any changes yesterday that fixed flakes (I think this branch is only behind 14 commits, I believe all from yesterday)

@zuercher zuercher merged commit fa880c9 into envoyproxy:master Apr 16, 2020
@wrowe wrowe deleted the thrift-proxy-mocks-windows-compilatin branch April 16, 2020 20:19
@sunjayBhatia sunjayBhatia mentioned this pull request Apr 24, 2020
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.

3 participants