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

Latest build of ontexplorer fails to pass tests #132

Closed
ksemaev opened this issue Jul 17, 2019 · 7 comments
Closed

Latest build of ontexplorer fails to pass tests #132

ksemaev opened this issue Jul 17, 2019 · 7 comments
Assignees

Comments

@ksemaev
Copy link
Contributor

ksemaev commented Jul 17, 2019

@NashMiao please advice, I receive this when trying to build from 6e529790016891c28200ff8b7840522a00696cba (supposed fix for #125 (comment)):

[INFO] Tests run: 3, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.185 s - in com.github.ontio.BasicTest
[INFO]
[INFO] Results:
[INFO]
[ERROR] Errors:
[ERROR] DemoApplicationTests.contextLoads » IllegalState Failed to load ApplicationCon...
[ERROR] updateContractInfoTest.updateContract » IllegalState Failed to load Applicatio...
[INFO]
[ERROR] Tests run: 5, Failures: 0, Errors: 2, Skipped:

Should I disable tests , or you can fix it?

@ksemaev
Copy link
Contributor Author

ksemaev commented Jul 17, 2019

Tried to run the version with skipped tests and got this:

[ ERROR] [2019-07-17 09:13:02] org.springframework.boot.SpringApplication [842] - Application run failed
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'OntIdService' defined in URL [jar:file:/home/ontology/app.jar!/BOOT-INF/classes!/com/github/ontio/service/impl/OntIdServiceImpl.class]: Unsatisfied dependency expressed through constructor parameter 2; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'ParamsConfig': Injection of autowired dependencies failed; nested exception is java.lang.IllegalArgumentException: Could not resolve placeholder 'dapp.reward.percentage' in value "${dapp.reward.percentage}"

@aweigold
Copy link
Contributor

The tests are working here for myself from a clean checkout of the version2.0 branch. Could you post the surefire-reports from the target folder showing the test failure?

@ksemaev
Copy link
Contributor Author

ksemaev commented Jul 17, 2019

@aweigold You can reproduce it with dockerfile:

################################
### Builder image
################################
FROM maven:3.6.1-slim

ENV VERSION=6e529790016891c28200ff8b7840522a00696cba \
    ONTOLOGY_MYSQL_ADDRESS=localhost \
    ONTOLOGY_MYSQL_DBNAME=explorer \
    ONTOLOGY_MYSQL_USER=ontology \
    ONTOLOGY_MYSQL_PASSWORD=qwerty \
    ONTOLOGY_REDIS_ADDRESS=localhost \
    ONTOLOGY_REDIS_PASSWORD=qwerty \
    ONTOLOGY_NODE_ADDRESS=dappnode1.ont.io \
    ONTOLOGY_NODE_PORT=20334

RUN apt update && \
    apt install -y \
    git

RUN git clone https://github.com/ontio/ontology-explorer.git && \
    cd ontology-explorer && \
    git checkout $VERSION

COPY application-dev.properties /ontology-explorer/back-end-projects/Explorer/config/

WORKDIR /ontology-explorer

RUN cd back-end-projects/Explorer && \
    mvn clean package

@ksemaev
Copy link
Contributor Author

ksemaev commented Jul 17, 2019

Just ran it on my mac^^ And received the same error
Maybe I use wrong commit id as version. There's still no tags here :(

@aweigold
Copy link
Contributor

aweigold commented Jul 17, 2019

I just ran the build from your commit id with your env vars from maven:3.6.1-slim here, and the build succeeded. Likely what is happening is that there are properties you are changing in the dev profile which are failing the Spring test app context.

You could resolve this by moving the COPY command after the build. That said however, it wouldn't change your runtime error you also mentioned.

Looking at the base application-dev.properties file, the missing property you have in your error exists (with a recent commit on 2019-07-05). You could rebase from it. A better way to manage this for yourself however would be to take the following steps (these are undocumented by ontio, but this is supported by Spring):

  • Make a new property file with just your overrides, call it application-<my-org>.properties
  • Copy that property file to the config location.
  • Set the env variable SPRING_ACTIVE_PROFILES=<my-org>.

Let me know if that works for you.

@ksemaev
Copy link
Contributor Author

ksemaev commented Jul 18, 2019

@aweigold TY! I indeed had my custom properties file, which I created just for replacing connection settings with vars (to have different var values in different envs), like this:

spring.datasource.url=jdbc:mysql://ONTOLOGY_MYSQL_ADDRESS:3306/ONTOLOGY_MYSQL_DBNAME?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&serverTimezone=UTC

hence: #108

And seems like my current config is missing those values:

reqlimit.expire.millisecond=1000
dapp.reward.percentage=60
node.reward.percentage=30
balanceservice.host=http://192.168.3.88:20334
querybalance.mode=0

@ksemaev
Copy link
Contributor Author

ksemaev commented Jul 18, 2019

Yep, my custom config was the reason for tests to fail, closing this one up

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

No branches or pull requests

3 participants